From d977ad0482aa1b4e5e818ae59727bbebd87fefc2 Mon Sep 17 00:00:00 2001 From: "tsteven4@gmail.com" Date: Wed, 22 Jan 2014 03:43:56 +0000 Subject: [PATCH] use the waypoint ctors/dtors/methods from r4721 directly. this change was mostly done by a script with ed. git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@4722 f51c46e8-681c-474f-0cfe-069cfd0219fb --- gpsbabel/alan.cc | 4 ++-- gpsbabel/an1.cc | 4 ++-- gpsbabel/arcdist.cc | 10 ++++----- gpsbabel/bcr.cc | 4 ++-- gpsbabel/bend.cc | 8 +++---- gpsbabel/brauniger_iq.cc | 2 +- gpsbabel/bushnell.cc | 2 +- gpsbabel/bushnell_trl.cc | 2 +- gpsbabel/compegps.cc | 4 ++-- gpsbabel/cst.cc | 8 +++---- gpsbabel/csv_util.cc | 20 ++++++++--------- gpsbabel/delbin.cc | 12 +++++------ gpsbabel/delgpl.cc | 4 ++-- gpsbabel/destinator.cc | 6 +++--- gpsbabel/dg-100.cc | 2 +- gpsbabel/discard.cc | 2 +- gpsbabel/dmtlog.cc | 10 ++++----- gpsbabel/duplicate.cc | 6 +++--- gpsbabel/easygps.cc | 2 +- gpsbabel/enigma.cc | 2 +- gpsbabel/exif.cc | 2 +- gpsbabel/format_skeleton.cc | 4 ++-- gpsbabel/g7towin.cc | 6 +++--- gpsbabel/garmin.cc | 16 +++++++------- gpsbabel/garmin_fit.cc | 2 +- gpsbabel/garmin_gpi.cc | 6 +++--- gpsbabel/garmin_txt.cc | 6 +++--- gpsbabel/garmin_xt.cc | 6 +++--- gpsbabel/gdb.cc | 20 ++++++++--------- gpsbabel/geo.cc | 4 ++-- gpsbabel/ggv_log.cc | 2 +- gpsbabel/ggv_ovl.cc | 4 ++-- gpsbabel/glogbook.cc | 2 +- gpsbabel/gnav_trl.cc | 2 +- gpsbabel/google.cc | 2 +- gpsbabel/googledir.cc | 2 +- gpsbabel/gopal.cc | 4 ++-- gpsbabel/gpsutil.cc | 2 +- gpsbabel/gpx.cc | 30 +++++++++++++------------- gpsbabel/gtm.cc | 6 +++--- gpsbabel/gtrnctr.cc | 14 ++++++------ gpsbabel/hiketech.cc | 4 ++-- gpsbabel/holux.cc | 2 +- gpsbabel/humminbird.cc | 16 +++++++------- gpsbabel/igc.cc | 8 +++---- gpsbabel/ignrando.cc | 2 +- gpsbabel/igo8.cc | 2 +- gpsbabel/ik3d.cc | 4 ++-- gpsbabel/interpolate.cc | 8 +++---- gpsbabel/itracku.cc | 4 ++-- gpsbabel/jogmap.cc | 2 +- gpsbabel/jtr.cc | 2 +- gpsbabel/kml.cc | 8 +++---- gpsbabel/lmx.cc | 2 +- gpsbabel/lowranceusr.cc | 8 +++---- gpsbabel/lowranceusr4.cc | 6 +++--- gpsbabel/maggeo.cc | 4 ++-- gpsbabel/magproto.cc | 6 +++--- gpsbabel/main.cc | 4 ++-- gpsbabel/mapasia.cc | 6 +++--- gpsbabel/mapbar_track.cc | 2 +- gpsbabel/mapsend.cc | 6 +++--- gpsbabel/mapsource.cc | 30 +++++++++++++------------- gpsbabel/mmo.cc | 10 ++++----- gpsbabel/mtk_locus.cc | 4 ++-- gpsbabel/mtk_logger.cc | 6 +++--- gpsbabel/navicache.cc | 6 +++--- gpsbabel/naviguide.cc | 2 +- gpsbabel/navilink.cc | 12 +++++------ gpsbabel/navitel.cc | 2 +- gpsbabel/netstumbler.cc | 2 +- gpsbabel/nmea.cc | 16 +++++++------- gpsbabel/nmn4.cc | 2 +- gpsbabel/osm.cc | 6 +++--- gpsbabel/overlay.cc | 4 ++-- gpsbabel/ozi.cc | 10 ++++----- gpsbabel/pcx.cc | 6 +++--- gpsbabel/pocketfms_bc.cc | 2 +- gpsbabel/pocketfms_fp.cc | 8 +++---- gpsbabel/pocketfms_wp.cc | 2 +- gpsbabel/polygon.cc | 2 +- gpsbabel/position.cc | 4 ++-- gpsbabel/psitrex.cc | 6 +++--- gpsbabel/radius.cc | 2 +- gpsbabel/random.cc | 2 +- gpsbabel/raymarine.cc | 4 ++-- gpsbabel/route.cc | 2 +- gpsbabel/saroute.cc | 8 +++---- gpsbabel/sbn.cc | 2 +- gpsbabel/shape.cc | 4 ++-- gpsbabel/skyforce.cc | 2 +- gpsbabel/skytraq.cc | 6 +++--- gpsbabel/smplrout.cc | 2 +- gpsbabel/stackfilter.cc | 2 +- gpsbabel/stmsdf.cc | 2 +- gpsbabel/stmwpp.cc | 4 ++-- gpsbabel/tef_xml.cc | 6 +++--- gpsbabel/teletype.cc | 2 +- gpsbabel/tiger.cc | 2 +- gpsbabel/tmpro.cc | 4 ++-- gpsbabel/tomtom.cc | 4 ++-- gpsbabel/tpg.cc | 2 +- gpsbabel/tpo.cc | 10 ++++----- gpsbabel/trackfilter.cc | 10 ++++----- gpsbabel/transform.cc | 4 ++-- gpsbabel/unicsv.cc | 10 ++++----- gpsbabel/v900.cc | 4 ++-- gpsbabel/vidaone.cc | 2 +- gpsbabel/vitosmt.cc | 2 +- gpsbabel/vitovtt.cc | 2 +- gpsbabel/vpl.cc | 2 +- gpsbabel/waypt.cc | 43 +++---------------------------------- gpsbabel/wbt-200.cc | 2 +- gpsbabel/wfff_xml.cc | 2 +- gpsbabel/wintec_tes.cc | 4 ++-- gpsbabel/xol.cc | 2 +- gpsbabel/yahoo.cc | 2 +- 117 files changed, 315 insertions(+), 352 deletions(-) diff --git a/gpsbabel/alan.cc b/gpsbabel/alan.cc index e4b10901d..661b416a8 100644 --- a/gpsbabel/alan.cc +++ b/gpsbabel/alan.cc @@ -508,7 +508,7 @@ static waypoint* get_wpt(struct wprdata* wprdata, unsigned n) } wpt = &(wprdata->wpt[idx]); - WP = waypt_new(); + WP = new waypoint; WP->latitude = -pt2deg(wpt->pt.y); WP->longitude = pt2deg(wpt->pt.x); WP->SetCreationTime(unpack_time(wpt->date, wpt->time)); @@ -643,7 +643,7 @@ static void trl_read(void) /* track points */ trklog = &(trldata.trklog[i]); for (j=0; jtotalpt; j++) { - WP = waypt_new(); + WP = new waypoint; WP->latitude = -pt2deg(trklog->pt[j].y); WP->longitude = pt2deg(trklog->pt[j].x); WP->altitude = hgt2m(trklog->sh[j].height); diff --git a/gpsbabel/an1.cc b/gpsbabel/an1.cc index 80bc8e128..b9e51ad21 100644 --- a/gpsbabel/an1.cc +++ b/gpsbabel/an1.cc @@ -699,7 +699,7 @@ static void Read_AN1_Waypoints(gbfile* f) for (i = 0; i < count; i++) { rec = Alloc_AN1_Waypoint(); Read_AN1_Waypoint(f, rec); - wpt_tmp = waypt_new(); + wpt_tmp = new waypoint; if (rec->creation_time) { wpt_tmp->SetCreationTime(rec->creation_time); @@ -874,7 +874,7 @@ static void Read_AN1_Lines(gbfile* f) Read_AN1_Vertex(f, vert); /* create route point */ - wpt_tmp = waypt_new(); + wpt_tmp = new waypoint; wpt_tmp->latitude = DecodeOrd(vert->lat); wpt_tmp->longitude = -DecodeOrd(vert->lon); wpt_tmp->shortname = QString().sprintf("\\%5.5lx", rtserial++); diff --git a/gpsbabel/arcdist.cc b/gpsbabel/arcdist.cc index d02ca206f..83bf867e2 100644 --- a/gpsbabel/arcdist.cc +++ b/gpsbabel/arcdist.cc @@ -164,8 +164,8 @@ arcdist_process(void) file_in = gbfopen(arcfileopt, "r", MYNAME); - arcpt1 = waypt_new(); - arcpt2 = waypt_new(); + arcpt1 = new waypoint; + arcpt2 = new waypoint; arcdist_arc_disp_hdr_cb(NULL); arcpt2->latitude = arcpt2->longitude = BADVAL; @@ -195,8 +195,8 @@ arcdist_process(void) arcpt2 = arcpttmp; } } - waypt_free(arcpt1); - waypt_free(arcpt2); + delete arcpt1; + delete arcpt2; gbfclose(file_in); } else if (rteopt) { @@ -218,7 +218,7 @@ arcdist_process(void) if (ed) { if ((ed->distance >= pos_dist) == (exclopt == NULL)) { waypt_del(wp); - waypt_free(wp); + delete wp; removed++; } else if (projectopt) { wp->longitude = ed->prjlongitude; diff --git a/gpsbabel/bcr.cc b/gpsbabel/bcr.cc index 9c2d77fea..18a3e073d 100644 --- a/gpsbabel/bcr.cc +++ b/gpsbabel/bcr.cc @@ -218,7 +218,7 @@ bcr_create_waypts_from_route(route_head* route) queue* elem, *tmp; QUEUE_FOR_EACH(&route->waypoint_list, elem, tmp) { - wpt = waypt_dupe((waypoint*) elem); + wpt = new waypoint(*(waypoint*) elem); waypt_add(wpt); } } @@ -286,7 +286,7 @@ bcr_data_read(void) fatal(MYNAME ": structure error at %s (Coordinates)!\n", station); } - wpt = waypt_new(); + wpt = new waypoint; wpt->shortname = station; bcr_mercator_to_wgs84(mlat, mlon, &wpt->latitude, &wpt->longitude); diff --git a/gpsbabel/bend.cc b/gpsbabel/bend.cc index ef7d58b91..828612212 100644 --- a/gpsbabel/bend.cc +++ b/gpsbabel/bend.cc @@ -90,7 +90,7 @@ create_wpt_dest(const waypoint* wpt_orig, double lat_orig, linepart(lat_orig, long_orig, lat_orig_adj, long_orig_adj, frac, &lat_dest, &long_dest); - wpt_dest = waypt_dupe(wpt_orig); + wpt_dest = new waypoint(*wpt_orig); wpt_dest->latitude = DEG(lat_dest); wpt_dest->longitude = DEG(long_dest); @@ -126,7 +126,7 @@ process_route(const route_head* route_orig, route_head* route_dest) if (wpt_orig_prev == NULL) { if (wpt_orig != NULL) { - waypoint* waypoint_dest = waypt_dupe(wpt_orig); + waypoint* waypoint_dest = new waypoint(*wpt_orig); route_add_wpt(route_dest, waypoint_dest); } } else { @@ -142,7 +142,7 @@ process_route(const route_head* route_orig, route_head* route_dest) if (is_small_angle(lat_orig, long_orig, lat_orig_prev, long_orig_prev, lat_orig_next, long_orig_next)) { - waypoint* waypoint_dest = waypt_dupe(wpt_orig); + waypoint* waypoint_dest = new waypoint(*wpt_orig); route_add_wpt(route_dest, waypoint_dest); } else { waypoint* wpt_dest_prev = create_wpt_dest(wpt_orig, @@ -166,7 +166,7 @@ process_route(const route_head* route_orig, route_head* route_dest) } if (wpt_orig != NULL) { - waypoint* waypoint_dest = waypt_dupe(wpt_orig); + waypoint* waypoint_dest = new waypoint(*wpt_orig); route_add_wpt(route_dest, waypoint_dest); } } diff --git a/gpsbabel/brauniger_iq.cc b/gpsbabel/brauniger_iq.cc index a32f44a52..b96d160b7 100644 --- a/gpsbabel/brauniger_iq.cc +++ b/gpsbabel/brauniger_iq.cc @@ -200,7 +200,7 @@ static int process_data(const unsigned char* data) break; case st_sample_alt: - wpt = waypt_new(); + wpt = new waypoint; wpt->latitude = wpt->longitude = 0.0; wpt->SetCreationTime(creation); creation += interval; diff --git a/gpsbabel/bushnell.cc b/gpsbabel/bushnell.cc index 5c712ab9d..856b6b0e0 100644 --- a/gpsbabel/bushnell.cc +++ b/gpsbabel/bushnell.cc @@ -205,7 +205,7 @@ bushnell_read(void) int32_t lat_tmp,lon_tmp; unsigned int proximity; unsigned int icon; - waypoint* wpt_tmp = waypt_new(); + waypoint* wpt_tmp = new waypoint; lat_tmp = gbfgetint32(file_in); lon_tmp = gbfgetint32(file_in); diff --git a/gpsbabel/bushnell_trl.cc b/gpsbabel/bushnell_trl.cc index 7ca941cb9..26370d190 100644 --- a/gpsbabel/bushnell_trl.cc +++ b/gpsbabel/bushnell_trl.cc @@ -106,7 +106,7 @@ bushnell_read(void) break; } - wpt_tmp = waypt_new(); + wpt_tmp = new waypoint; wpt_tmp->latitude = lat_tmp / 10000000.0; wpt_tmp->longitude = lon_tmp / 10000000.0; diff --git a/gpsbabel/compegps.cc b/gpsbabel/compegps.cc index cd4e71efd..ca3f82e72 100644 --- a/gpsbabel/compegps.cc +++ b/gpsbabel/compegps.cc @@ -160,7 +160,7 @@ parse_wpt(char* buff) { int col = -1; char* c, *cx; - waypoint* wpt = waypt_new(); + waypoint* wpt = new waypoint; struct tm tm; int has_time = 0; memset(&tm, 0, sizeof(tm)); @@ -278,7 +278,7 @@ parse_trkpt(char* buff) int col = -1; char* c; struct tm tm; - waypoint* wpt = waypt_new(); + waypoint* wpt = new waypoint; c = strstr(buff, "A "); if (c == buff) { diff --git a/gpsbabel/cst.cc b/gpsbabel/cst.cc index 894eaf44f..cda0949fe 100644 --- a/gpsbabel/cst.cc +++ b/gpsbabel/cst.cc @@ -59,9 +59,9 @@ cst_add_wpt(const route_head* track, waypoint* wpt) } if (wpt->shortname != NULL) { - waypt_add(waypt_dupe(wpt)); + waypt_add(new waypoint(*wpt)); // Rather than creating a new waypt on each read, tis format bizarrely - // recycles the same one, relying on waypt_dupe() above and then manually + // recycles the same one, relying on new waypoint(*) above and then manually // resetting fields. Weird. wpt->url_link_list_.clear(); @@ -69,7 +69,7 @@ cst_add_wpt(const route_head* track, waypoint* wpt) temp_route = route_head_alloc(); route_add_head(temp_route); } - route_add_wpt(temp_route, waypt_dupe(wpt)); + route_add_wpt(temp_route, new waypoint(*wpt)); } track_add_wpt((route_head*)track, (waypoint*)wpt); } @@ -266,7 +266,7 @@ cst_data_read(void) wpt = NULL; - wpt = waypt_new(); + wpt = new waypoint; if (5 != sscanf(cin, "%lf %lf %lf %d %s", &wpt->longitude, diff --git a/gpsbabel/csv_util.cc b/gpsbabel/csv_util.cc index e6e9136b1..df8e1702c 100644 --- a/gpsbabel/csv_util.cc +++ b/gpsbabel/csv_util.cc @@ -1243,33 +1243,33 @@ xcsv_parse_val(const char* s, waypoint* wpt, const field_map_t* fmp, } break; case XT_GEOCACHE_LAST_FOUND: - waypt_alloc_gc_data(wpt)->last_found = yyyymmdd_to_time(s); + wpt->AllocGCData()->last_found = yyyymmdd_to_time(s); break; /* GEOCACHING STUFF ***************************************************/ case XT_GEOCACHE_DIFF: /* Geocache Difficulty as an int */ - waypt_alloc_gc_data(wpt)->diff = atof(s) * 10; + wpt->AllocGCData()->diff = atof(s) * 10; break; case XT_GEOCACHE_TERR: /* Geocache Terrain as an int */ - waypt_alloc_gc_data(wpt)->terr = atof(s) * 10; + wpt->AllocGCData()->terr = atof(s) * 10; break; case XT_GEOCACHE_TYPE: /* Geocache Type */ - waypt_alloc_gc_data(wpt)->type = gs_mktype(s); + wpt->AllocGCData()->type = gs_mktype(s); break; case XT_GEOCACHE_CONTAINER: - waypt_alloc_gc_data(wpt)->container = gs_mkcont(s); + wpt->AllocGCData()->container = gs_mkcont(s); break; case XT_GEOCACHE_HINT: - waypt_alloc_gc_data(wpt)->hint = QString(s).trimmed(); + wpt->AllocGCData()->hint = QString(s).trimmed(); break; case XT_GEOCACHE_PLACER: - waypt_alloc_gc_data(wpt)->placer = QString(s).trimmed(); + wpt->AllocGCData()->placer = QString(s).trimmed(); break; case XT_GEOCACHE_ISAVAILABLE: - gc_data = waypt_alloc_gc_data(wpt); + gc_data = wpt->AllocGCData(); if (case_ignore_strcmp(csv_stringtrim(s, ""), "False") == 0) { gc_data->is_available = status_false; } else if (case_ignore_strcmp(csv_stringtrim(s, ""), "True") == 0) { @@ -1279,7 +1279,7 @@ xcsv_parse_val(const char* s, waypoint* wpt, const field_map_t* fmp, } break; case XT_GEOCACHE_ISARCHIVED: - gc_data = waypt_alloc_gc_data(wpt); + gc_data = wpt->AllocGCData(); if (case_ignore_strcmp(csv_stringtrim(s, ""), "False") == 0) { gc_data->is_archived = status_false; } else if (case_ignore_strcmp(csv_stringtrim(s, ""), "True") == 0) { @@ -1473,7 +1473,7 @@ xcsv_data_read(void) } if (strlen(buff)) { - wpt_tmp = waypt_new(); + wpt_tmp = new waypoint; s = buff; s = csv_lineparse(s, xcsv_file.field_delimiter, diff --git a/gpsbabel/delbin.cc b/gpsbabel/delbin.cc index 08c47d1e5..fcb2cd450 100644 --- a/gpsbabel/delbin.cc +++ b/gpsbabel/delbin.cc @@ -994,7 +994,7 @@ decode_time(const uint8_t* p) static waypoint* decode_waypoint(const void* data) { - waypoint* wp = waypt_new(); + waypoint* wp = new waypoint; const msg_waypoint_t* p = (const msg_waypoint_t*)data; const char* s; float f; @@ -1400,7 +1400,7 @@ write_waypoint(const waypoint* wp) float elev = UNKNOWN_ELEV; char* pp; - if (waypt_empty_gc_data(wp)) { + if (wp->EmptyGCData()) { notes = xstrdup(wp->notes); if (notes == NULL && wp->description.isEmpty() && wp->shortname != wp->description) { notes = xstrdup(wp->description); @@ -1554,7 +1554,7 @@ decode_track_point(const void* data, unsigned* wp_array_i, unsigned max_point) fatal(MYNAME ": read too many track points\n"); } for (i = 0; i < n; i++, j++) { - waypoint* wp = waypt_new(); + waypoint* wp = new waypoint; float elev = le_read_float(p->point[i].elevation); wp_array[j] = wp; wp->SetCreationTime(decode_time(&p->point[i].year)); @@ -1863,7 +1863,7 @@ decode_route_shape(const void* data, unsigned* wp_array_i) for (i = 0; i < n; i++, j++) { char buf[32]; - waypoint* wp = waypt_new(); + waypoint* wp = new waypoint; wp_array[j] = wp; wp->latitude = delbin_rad2deg(le_read32(p->point[i].latitude)); wp->longitude = delbin_rad2deg(le_read32(p->point[i].longitude)); @@ -1879,7 +1879,7 @@ decode_route_point(const void* data) const msg_route_point_t* p = (const msg_route_point_t*) data; const char* s = NULL; gbfile* fd = gbfopen(NULL, "w", MYNAME); - waypoint* wp = waypt_new(); + waypoint* wp = new waypoint; if (p->name[0]) { wp->shortname = p->name; } @@ -2265,7 +2265,7 @@ write_routes(void) static waypoint* decode_navmsg(const void* data) { - waypoint* wp = waypt_new(); + waypoint* wp = new waypoint; const msg_navigation_t* p = (const msg_navigation_t*) data; struct tm t; diff --git a/gpsbabel/delgpl.cc b/gpsbabel/delgpl.cc index eb83d11e7..e240980f2 100644 --- a/gpsbabel/delgpl.cc +++ b/gpsbabel/delgpl.cc @@ -63,7 +63,7 @@ gpl_read(void) track_add_head(track_head); while (gbfread(&gp, sizeof(gp), 1, gplfile_in) > 0) { - wpt_tmp = waypt_new(); + wpt_tmp = new waypoint; wpt_tmp->latitude = le_read_double(&gp.lat); wpt_tmp->longitude = le_read_double(&gp.lon); alt_feet = le_read_double(&gp.alt); @@ -95,7 +95,7 @@ gpl_read(void) // in time. The only thing I see "special" about those // trackpoints is that these fields are zeroed. Toss them. if ((wpt_tmp->speed == 0.0) && (wpt_tmp->course == 0.0)) { - waypt_free(wpt_tmp); + delete wpt_tmp; continue; } track_add_wpt(track_head, wpt_tmp); diff --git a/gpsbabel/destinator.cc b/gpsbabel/destinator.cc index 87344d1e9..379205fe5 100644 --- a/gpsbabel/destinator.cc +++ b/gpsbabel/destinator.cc @@ -172,7 +172,7 @@ destinator_read_poi(void) count++; - wpt = waypt_new(); + wpt = new waypoint; wpt->shortname = read_wcstr(0); wpt->notes = read_wcstr(0); /* comment */ @@ -247,7 +247,7 @@ destinator_read_rte(void) count++; - wpt = waypt_new(); + wpt = new waypoint; wpt->shortname = read_wcstr(0); wpt->notes = read_wcstr(0); @@ -297,7 +297,7 @@ destinator_read_trk(void) break; } - wpt = waypt_new(); + wpt = new waypoint; wpt->longitude = gbfgetdbl(fin); wpt->latitude = gbfgetdbl(fin); diff --git a/gpsbabel/dg-100.cc b/gpsbabel/dg-100.cc index b8ad6d5d4..b51a39fbe 100644 --- a/gpsbabel/dg-100.cc +++ b/gpsbabel/dg-100.cc @@ -266,7 +266,7 @@ process_gpsfile(uint8_t data[], route_head** track) track_add_head(*track); } - wpt = waypt_new(); + wpt = new waypoint; latitude = bin2deg(lat); if (latitude >= 100) { manual_point = 1; diff --git a/gpsbabel/discard.cc b/gpsbabel/discard.cc index fae159299..5ebe298a0 100644 --- a/gpsbabel/discard.cc +++ b/gpsbabel/discard.cc @@ -135,7 +135,7 @@ fix_process_wpt(const waypoint* wpt) default: return; } - waypt_free(waypointp); + delete waypointp; } } diff --git a/gpsbabel/dmtlog.cc b/gpsbabel/dmtlog.cc index 8a153dd9b..ef27bb95f 100644 --- a/gpsbabel/dmtlog.cc +++ b/gpsbabel/dmtlog.cc @@ -253,7 +253,7 @@ tlog3b_xgcb_tfdes(xg_string args, const QXmlStreamAttributes* unused) static void tlog3b_xgcb_wptst(xg_string args, const QXmlStreamAttributes* unused) { - xmlwpt = waypt_new(); + xmlwpt = new waypoint; xmldatum = DATUM_WGS84; } @@ -261,7 +261,7 @@ tlog3b_xgcb_wptst(xg_string args, const QXmlStreamAttributes* unused) static void tlog3b_xgcb_tptst(xg_string args, const QXmlStreamAttributes* unused) { - xmlwpt = waypt_new(); + xmlwpt = new waypoint; xmldatum = DATUM_WGS84; } @@ -481,7 +481,7 @@ read_CTrackFile(const int version) datum = read_datum(fin); } - wpt = waypt_new(); + wpt = new waypoint; wpt->latitude = gbfgetdbl(fin); wpt->longitude = gbfgetdbl(fin); @@ -527,7 +527,7 @@ read_CTrackFile(const int version) gbfungetc(i, fin); datum = read_datum(fin); - wpt = waypt_new(); + wpt = new waypoint; wpt->latitude = gbfgetdbl(fin); wpt->longitude = gbfgetdbl(fin); @@ -557,7 +557,7 @@ read_CTrackFile(const int version) wcount--; - wpt = waypt_new(); + wpt = new waypoint; wpt->latitude = gbfgetdbl(fin); wpt->longitude = gbfgetdbl(fin); diff --git a/gpsbabel/duplicate.cc b/gpsbabel/duplicate.cc index d723a5040..338ca5cfd 100644 --- a/gpsbabel/duplicate.cc +++ b/gpsbabel/duplicate.cc @@ -233,7 +233,7 @@ duplicate_process(void) if (btmp == NULL) { if (delwpt) { - waypt_free(delwpt); + delete delwpt; } if (correct_coords && oldnode && oldnode->wpt) { oldnode->wpt->latitude = waypointp->latitude; @@ -245,7 +245,7 @@ duplicate_process(void) if (purge_duplicates && oldnode) { if (oldnode->wpt) { waypt_del(oldnode->wpt); - waypt_free(oldnode->wpt); + delete oldnode->wpt; oldnode->wpt = NULL; } } @@ -256,7 +256,7 @@ duplicate_process(void) } if (delwpt) { - waypt_free(delwpt); + delete delwpt; } xfree(htable); diff --git a/gpsbabel/easygps.cc b/gpsbabel/easygps.cc index 7c25eb0ae..52fa6acc1 100644 --- a/gpsbabel/easygps.cc +++ b/gpsbabel/easygps.cc @@ -83,7 +83,7 @@ data_read(void) unsigned char tag; waypoint* wpt_tmp; - wpt_tmp = waypt_new(); + wpt_tmp = new waypoint; UrlLink link; for (tag = gbfgetc(file_in); tag != 0xff; tag = gbfgetc(file_in)) { diff --git a/gpsbabel/enigma.cc b/gpsbabel/enigma.cc index 30d571e48..7272fa4f3 100644 --- a/gpsbabel/enigma.cc +++ b/gpsbabel/enigma.cc @@ -108,7 +108,7 @@ data_read(void) route_add_head(route); while (1 == gbfread(&ewpt, sizeof(ewpt), 1, file_in)) { - waypoint* wpt = waypt_new(); + waypoint* wpt = new waypoint; wpt->latitude = enigmaPositionToDec(le_read32(&ewpt.latitude)); wpt->longitude = enigmaPositionToDec(le_read32(&ewpt.longitude)); char*sn = xstrndup(ewpt.shortname, ewpt.shortname_len); diff --git a/gpsbabel/exif.cc b/gpsbabel/exif.cc index 7f92bcf4f..8eb739744 100644 --- a/gpsbabel/exif.cc +++ b/gpsbabel/exif.cc @@ -693,7 +693,7 @@ exif_waypt_from_exif_app(exif_app_t* app) return NULL; } - wpt = waypt_new(); + wpt = new waypoint; wpt->latitude = unknown_alt; wpt->longitude = unknown_alt; diff --git a/gpsbabel/format_skeleton.cc b/gpsbabel/format_skeleton.cc index 78a87b72d..28db1451e 100644 --- a/gpsbabel/format_skeleton.cc +++ b/gpsbabel/format_skeleton.cc @@ -84,7 +84,7 @@ format_skeleton_read(void) // // For waypoints: // while (have waypoints) { -// waypoint = waypt_new() +// waypoint = new waypoint // populate waypoint // waypt_add(waypoint); // } @@ -95,7 +95,7 @@ format_skeleton_read(void) // populate struct route_hdr // route_add_head(route); // while (have more routepoints) { -// waypoint = waypt_new() +// waypoint = new waypoint // populate waypoint // route_add_wpt(route, waypoint) // } diff --git a/gpsbabel/g7towin.cc b/gpsbabel/g7towin.cc index 67c22ab27..2121de355 100644 --- a/gpsbabel/g7towin.cc +++ b/gpsbabel/g7towin.cc @@ -273,7 +273,7 @@ parse_waypt(char* buff) waypoint* wpt; garmin_fs_p gmsd; - wpt = waypt_new(); + wpt = new waypoint; gmsd = garmin_fs_alloc(-1); fs_chain_add(&wpt->fs, (format_specific_data*) gmsd); @@ -347,7 +347,7 @@ parse_trkpt(char* buff) garmin_fs_p gmsd; waypoint* wpt; - wpt = waypt_new(); + wpt = new waypoint; gmsd = garmin_fs_alloc(-1); fs_chain_add(&wpt->fs, (format_specific_data*) gmsd); @@ -459,7 +459,7 @@ data_read(void) break; case 'I': /* event point */ - wpt = waypt_new(); + wpt = new waypoint; cdata += parse_coordinates(cdata, datum, grid, &wpt->latitude, &wpt->longitude, MYNAME); xasprintf(&wpt->shortname, "Event%d", ++event_ct); diff --git a/gpsbabel/garmin.cc b/gpsbabel/garmin.cc index b6f9c4dbc..3e17716dd 100644 --- a/gpsbabel/garmin.cc +++ b/gpsbabel/garmin.cc @@ -338,7 +338,7 @@ waypt_read(void) GPS_PWay* way = NULL; if (getposn) { - waypoint* wpt = waypt_new(); + waypoint* wpt = new waypoint; wpt->latitude = gps_save_lat; wpt->longitude = gps_save_lon; wpt->shortname = "Position"; @@ -354,7 +354,7 @@ waypt_read(void) } for (i = 0; i < n; i++) { - waypoint* wpt_tmp = waypt_new(); + waypoint* wpt_tmp = new waypoint; wpt_tmp->shortname = way[i]->ident; wpt_tmp->description = QString(way[i]->cmnt).simplified(); @@ -491,7 +491,7 @@ track_read(void) if (array[i]->no_latlon || array[i]->ishdr) { continue; } - wpt = waypt_new(); + wpt = new waypoint; wpt->longitude = array[i]->lon; wpt->latitude = array[i]->lat; @@ -563,7 +563,7 @@ route_read(void) if (array[i]->islink) { continue; } else { - waypoint* wpt_tmp = waypt_new(); + waypoint* wpt_tmp = new waypoint; wpt_tmp->latitude = array[i]->lat; wpt_tmp->longitude = array[i]->lon; wpt_tmp->shortname = array[i]->ident; @@ -618,7 +618,7 @@ lap_read_as_track(void) trk_head->rte_name = tbuf; track_add_head(trk_head); - wpt = waypt_new(); + wpt = new waypoint; wpt->longitude = array[i]->begin_lon; wpt->latitude = array[i]->begin_lat; @@ -641,7 +641,7 @@ lap_read_as_track(void) * continue; * } */ - wpt = waypt_new(); + wpt = new waypoint; wpt->longitude = array[i]->end_lon; wpt->latitude = array[i]->end_lat; @@ -749,7 +749,7 @@ pvt_init(const char* fname) static waypoint* pvt_read(posn_status* posn_status) { - waypoint* wpt = waypt_new(); + waypoint* wpt = new waypoint; GPS_PPvt_Data pvt = GPS_Pvt_New(); if (GPS_Command_Pvt_Get(&pvt_fd, &pvt)) { @@ -773,7 +773,7 @@ pvt_read(posn_status* posn_status) fatal(MYNAME ": Fatal error reading position.\n"); } - waypt_free(wpt); + delete wpt; GPS_Pvt_Del(&pvt); return NULL; diff --git a/gpsbabel/garmin_fit.cc b/gpsbabel/garmin_fit.cc index 0f523c2d6..03c629f26 100644 --- a/gpsbabel/garmin_fit.cc +++ b/gpsbabel/garmin_fit.cc @@ -380,7 +380,7 @@ fit_parse_data(fit_message_def* def, int time_offset) break; } - waypt = waypt_new(); + waypt = new waypoint; waypt->latitude = (lat / (double)0x7fffffff) * 180; waypt->longitude = (lon / (double)0x7fffffff) * 180; if (alt != 0xffff) { diff --git a/gpsbabel/garmin_gpi.cc b/gpsbabel/garmin_gpi.cc index c14956c71..316496be9 100644 --- a/gpsbabel/garmin_gpi.cc +++ b/gpsbabel/garmin_gpi.cc @@ -388,7 +388,7 @@ read_poi(const int sz, const int tag) (void) len; pos = gbftell(fin); - wpt = waypt_new(); + wpt = new waypoint; wpt->icon_descr = DEFAULT_ICON; wpt->latitude = GPS_Math_Semi_To_Deg(gbfgetint32(fin)); @@ -824,7 +824,7 @@ wdata_free(writer_data_t* data) } xfree(dt); } - waypt_free(wpt); + delete wpt; } if (data->top_left) { @@ -1300,7 +1300,7 @@ enum_waypt_cb(const waypoint* ref) } } - wpt = waypt_dupe(ref); + wpt = new waypoint(*ref); if (*opt_unique == '1') { #if NEW_STRINGS diff --git a/gpsbabel/garmin_txt.cc b/gpsbabel/garmin_txt.cc index 8881654e4..59edaaf68 100644 --- a/gpsbabel/garmin_txt.cc +++ b/gpsbabel/garmin_txt.cc @@ -1141,7 +1141,7 @@ parse_waypoint(void) bind_fields(waypt_header); - wpt = waypt_new(); + wpt = new waypoint; gmsd = garmin_fs_alloc(-1); fs_chain_add(&wpt->fs, (format_specific_data*) gmsd); @@ -1300,7 +1300,7 @@ parse_route_waypoint(void) is_fatal((*str == '\0'), MYNAME ": Route waypoint without name at line %d!\n", current_line); wpt = find_waypt_by_name(str); is_fatal((wpt == NULL), MYNAME ": Route waypoint \"%s\" not in waypoint list (line %d)!\n", str, current_line); - wpt = waypt_dupe(wpt); + wpt = new waypoint(*wpt); break; } } @@ -1317,7 +1317,7 @@ parse_track_waypoint(void) waypoint* wpt; bind_fields(trkpt_header); - wpt = waypt_new(); + wpt = new waypoint; while ((str = csv_lineparse(NULL, "\t", "", column++))) { int field_no; diff --git a/gpsbabel/garmin_xt.cc b/gpsbabel/garmin_xt.cc index 4178261a5..c98623761 100644 --- a/gpsbabel/garmin_xt.cc +++ b/gpsbabel/garmin_xt.cc @@ -293,7 +293,7 @@ format_garmin_xt_proc_strk(void) // Add point to the track if not the first point if (!FirstCoo) { //create new waypoint - wpt = waypt_new(); + wpt = new waypoint; //populate wpt; wpt->latitude = PrevLat; /* Degrees */ @@ -319,7 +319,7 @@ format_garmin_xt_proc_strk(void) format_garmin_xt_decomp_last_ele(Count, &PrevEle, TrackBlock); //create new waypoint - wpt = waypt_new(); + wpt = new waypoint; //populate wpt; wpt->latitude = PrevLat; /* Degrees */ @@ -391,7 +391,7 @@ format_garmin_xt_proc_atrk(void) AltF = (double)uu * GARMIN_XT_ELE - 1500; //create new waypoint - wpt = waypt_new(); + wpt = new waypoint; //populate wpt; wpt->latitude = LatF*180/16777216; /* Degrees */ diff --git a/gpsbabel/gdb.cc b/gpsbabel/gdb.cc index 32f227b1a..1f4c1ba8a 100644 --- a/gpsbabel/gdb.cc +++ b/gpsbabel/gdb.cc @@ -161,7 +161,7 @@ gdb_flush_waypt_queue(queue* Q) xfree(wpt->extra_data); #endif } - waypt_free(wpt); + delete wpt; } } @@ -411,10 +411,10 @@ gdb_add_route_waypt(route_head* rte, waypoint* ref, const int wpt_class) turn_point = (gdb_roadbook && (wpt_class > gt_waypt_class_map_point) && tmp->description); #endif if (turn_point || (gdb_via == 0) || (wpt_class < gt_waypt_class_map_point)) { - res = waypt_dupe(tmp); + res = new waypoint(*tmp); route_add_wpt(rte, res); } - waypt_free(ref); + delete ref; return res; } @@ -555,7 +555,7 @@ read_waypoint(gt_waypt_classes_e* waypt_class_out) char* sn; #endif waypt_ct++; - res = waypt_new(); + res = new waypoint; gmsd = garmin_fs_alloc(-1); fs_chain_add(&res->fs, (format_specific_data*) gmsd); @@ -839,7 +839,7 @@ read_route(void) waypoint* wpt; - wpt = waypt_new(); + wpt = new waypoint; rtept_ct++; wpt->shortname = fread_cstr(); /* shortname */ @@ -936,8 +936,8 @@ read_route(void) /* Without links we need all informations from wpt */ waypoint* tmp = gdb_reader_find_waypt(wpt, 0); if (tmp != NULL) { - waypt_free(wpt); - wpt = waypt_dupe(tmp); + delete wpt; + wpt = new waypoint(*tmp); } else { if (waypt_bounds_valid(&bounds)) { warning(MYNAME ": (has bounds)\n"); @@ -1029,7 +1029,7 @@ read_track(void) points = FREAD_i32; for (index = 0; index < points; index++) { - waypoint* wpt = waypt_new(); + waypoint* wpt = new waypoint; trkpt_ct++; @@ -1146,7 +1146,7 @@ read_data(void) if ((gdb_via == 0) || (wpt_class == 0)) { waypoint* dupe; waypt_add(wpt); - dupe = waypt_dupe(wpt); + dupe = new waypoint(*wpt); ENQUEUE_TAIL(&wayptq_in, &dupe->Q); } else { ENQUEUE_TAIL(&wayptq_in_hidden, &wpt->Q); @@ -1761,7 +1761,7 @@ write_waypoint_cb(const waypoint* refpt) #else char* name; #endif - waypoint* wpt = waypt_dupe(refpt); + waypoint* wpt = new waypoint(*refpt); gdb_check_waypt(wpt); ENQUEUE_TAIL(&wayptq_out, &wpt->Q); diff --git a/gpsbabel/geo.cc b/gpsbabel/geo.cc index 1fb260b26..d9367666b 100644 --- a/gpsbabel/geo.cc +++ b/gpsbabel/geo.cc @@ -58,8 +58,8 @@ void GeoReadLoc() current_tag.append("/"); current_tag.append(tag_name); if (current_tag == "/loc/waypoint") { - wpt = waypt_new(); - waypt_alloc_gc_data(wpt); + wpt = new waypoint; + wpt->AllocGCData(); // There is no 'unknown' alt value and so many reference files have // leaked it that we just paper over that here. wpt->altitude = 0; diff --git a/gpsbabel/ggv_log.cc b/gpsbabel/ggv_log.cc index 71850ebca..a81a4ed76 100644 --- a/gpsbabel/ggv_log.cc +++ b/gpsbabel/ggv_log.cc @@ -124,7 +124,7 @@ ggv_log_read(void) memset(&tm, 0, sizeof(tm)); - wpt = waypt_new(); + wpt = new waypoint; deg = (int16_t) le_read16(&buf[0]); min = le_read16(&buf[2]); diff --git a/gpsbabel/ggv_ovl.cc b/gpsbabel/ggv_ovl.cc index cd68c551e..bf6ce7880 100644 --- a/gpsbabel/ggv_ovl.cc +++ b/gpsbabel/ggv_ovl.cc @@ -146,7 +146,7 @@ ggv_ovl_read(void) for (j = 0; j < points; j++) { - wpt = waypt_new(); + wpt = new waypoint; snprintf(coord, sizeof(coord), "YKoord%d", j); if ((cx = inifile_readstr(inifile, symbol, coord))) { @@ -174,7 +174,7 @@ ggv_ovl_read(void) case OVL_SYMBOL_CIRCLE: case OVL_SYMBOL_TRIANGLE: - wpt = waypt_new(); + wpt = new waypoint; wpt->shortname = symbol; if ((cx = inifile_readstr(inifile, symbol, "YKoord"))) { diff --git a/gpsbabel/glogbook.cc b/gpsbabel/glogbook.cc index ad985d269..2aa0d0eea 100644 --- a/gpsbabel/glogbook.cc +++ b/gpsbabel/glogbook.cc @@ -147,7 +147,7 @@ void gl_trk_s(xg_string args, const QXmlStreamAttributes* unused) void gl_trk_pnt_s(xg_string args, const QXmlStreamAttributes* unused) { - wpt_tmp = waypt_new(); + wpt_tmp = new waypoint; } void gl_trk_pnt_e(xg_string args, const QXmlStreamAttributes* unused) diff --git a/gpsbabel/gnav_trl.cc b/gpsbabel/gnav_trl.cc index c48557847..36d4bde70 100644 --- a/gpsbabel/gnav_trl.cc +++ b/gpsbabel/gnav_trl.cc @@ -98,7 +98,7 @@ gnav_trl_read(void) fatal(MYNAME ": Unexpected EOF (end of file)!\n"); } - wpt = waypt_new(); + wpt = new waypoint; wpt->SetCreationTime(le_read32(&rec.time)); wpt->latitude = le_read_float(&rec.lat); diff --git a/gpsbabel/google.cc b/gpsbabel/google.cc index 0ab3e5fd8..9970cbd26 100644 --- a/gpsbabel/google.cc +++ b/gpsbabel/google.cc @@ -243,7 +243,7 @@ void goog_poly_e(xg_string args, const QXmlStreamAttributes* unused) } { - waypoint* wpt_tmp = waypt_new(); + waypoint* wpt_tmp = new waypoint; wpt_tmp->latitude = lat / 100000.0; wpt_tmp->longitude = lon / 100000.0; wpt_tmp->route_priority=level; diff --git a/gpsbabel/googledir.cc b/gpsbabel/googledir.cc index f9dc44c32..66e92f9f9 100644 --- a/gpsbabel/googledir.cc +++ b/gpsbabel/googledir.cc @@ -126,7 +126,7 @@ goog_poly_e(xg_string args, const QXmlStreamAttributes* unused) lon += decode_goog64(&str); { - waypoint* wpt_tmp = waypt_new(); + waypoint* wpt_tmp = new waypoint; wpt_tmp->latitude = lat / 100000.0; wpt_tmp->longitude = lon / 100000.0; /* FIXME no need for name diff --git a/gpsbabel/gopal.cc b/gpsbabel/gopal.cc index 72106488c..06293a735 100644 --- a/gpsbabel/gopal.cc +++ b/gpsbabel/gopal.cc @@ -206,7 +206,7 @@ gopal_read(void) if ((nfields == 8) && (tx == 0)) { // fatal(MYNAME ": Invalid date in filename \"%s\", try to set manually using \"date\" switch!\n", buff); } - wpt = waypt_new(); + wpt = new waypoint; column = -1; // the format of gopal is quite simple. Unfortunately the developers forgot the date as the first element... @@ -333,7 +333,7 @@ gopal_read(void) long_old=wpt->longitude; lat_old=wpt->latitude; route_add_wpt(route,wpt); - waypt_add(waypt_dupe(wpt)); + waypt_add(new waypoint(*wpt)); } } } diff --git a/gpsbabel/gpsutil.cc b/gpsbabel/gpsutil.cc index 920426660..264750a0c 100644 --- a/gpsbabel/gpsutil.cc +++ b/gpsbabel/gpsutil.cc @@ -110,7 +110,7 @@ data_read(void) rtrim(sn); rtrim(desc); rtrim(icon); - wpt_tmp = waypt_new(); + wpt_tmp = new waypoint; wpt_tmp->altitude = alt; wpt_tmp->shortname = sn; xfree(sn); diff --git a/gpsbabel/gpx.cc b/gpsbabel/gpx.cc index 5b554fd8b..4c4bdf4d1 100644 --- a/gpsbabel/gpx.cc +++ b/gpsbabel/gpx.cc @@ -490,7 +490,7 @@ tag_gpx(const QXmlStreamAttributes& attr) static void tag_wpt(const QXmlStreamAttributes& attr) { - wpt_tmp = waypt_new(); + wpt_tmp = new waypoint; link_ = new UrlLink; cur_tag = NULL; @@ -517,7 +517,7 @@ tag_cache_desc(const QXmlStreamAttributes& attr) static void tag_gs_cache(const QXmlStreamAttributes& attr) { - geocache_data* gc_data = waypt_alloc_gc_data(wpt_tmp); + geocache_data* gc_data = wpt_tmp->AllocGCData(); if (attr.hasAttribute("id")) { gc_data->id = attr.value("id").toString().toInt(); @@ -608,7 +608,7 @@ static void tag_log_wpt(const QXmlStreamAttributes& attr) { /* create a new waypoint */ - waypoint* lwp_tmp = waypt_new(); + waypoint* lwp_tmp = new waypoint; /* extract the lat/lon attributes */ if (attr.hasAttribute("lat")) { @@ -700,7 +700,7 @@ gpx_start(const QString& el, const QXmlStreamAttributes& attr) break; case tt_cache_placer: if (attr.hasAttribute("id")) { - waypt_alloc_gc_data(wpt_tmp)->placer_id = attr.value("id").toString().toInt(); + wpt_tmp->AllocGCData()->placer_id = attr.value("id").toString().toInt(); } default: break; @@ -941,20 +941,20 @@ gpx_end(const QString& el) wpt_tmp->notes = cdatastr; break; case tt_cache_container: - waypt_alloc_gc_data(wpt_tmp)->container = gs_mkcont(cdatastr); + wpt_tmp->AllocGCData()->container = gs_mkcont(cdatastr); break; case tt_cache_type: - waypt_alloc_gc_data(wpt_tmp)->type = gs_mktype(cdatastr); + wpt_tmp->AllocGCData()->type = gs_mktype(cdatastr); break; case tt_cache_difficulty: x = cdatastr.toDouble(); - waypt_alloc_gc_data(wpt_tmp)->diff = x * 10; + wpt_tmp->AllocGCData()->diff = x * 10; break; case tt_cache_hint: - waypt_alloc_gc_data(wpt_tmp)->hint = cdatastr.trimmed(); + wpt_tmp->AllocGCData()->hint = cdatastr.trimmed(); break; case tt_cache_desc_long: { - geocache_data* gc_data = waypt_alloc_gc_data(wpt_tmp); + geocache_data* gc_data = wpt_tmp->AllocGCData(); gc_data->desc_long.is_html = cache_descr_is_html; // FIXME: Forcing a premature conversion here saves 4% on GPX read times // on large PQs. Once cdatastrp becomes real QString this is just (minimal) @@ -964,17 +964,17 @@ gpx_end(const QString& el) break; case tt_cache_desc_short: { - geocache_data* gc_data = waypt_alloc_gc_data(wpt_tmp); + geocache_data* gc_data = wpt_tmp->AllocGCData(); gc_data->desc_short.is_html = cache_descr_is_html; gc_data->desc_short.utfstring = cdatastr; } break; case tt_cache_terrain: x = cdatastr.toDouble(); - waypt_alloc_gc_data(wpt_tmp)->terr = x * 10; + wpt_tmp->AllocGCData()->terr = x * 10; break; case tt_cache_placer: - waypt_alloc_gc_data(wpt_tmp)->placer = cdatastr; + wpt_tmp->AllocGCData()->placer = cdatastr; break; case tt_cache_log_date: gc_log_date = xml_parse_time(cdatastr); @@ -987,15 +987,15 @@ gpx_end(const QString& el) case tt_cache_log_type: if ((cdatastr.compare("Found it") == 0) && (0 == wpt_tmp->gc_data->last_found.toTime_t())) { - waypt_alloc_gc_data(wpt_tmp)->last_found = gc_log_date; + wpt_tmp->AllocGCData()->last_found = gc_log_date; } gc_log_date = QDateTime(); break; case tt_cache_favorite_points: - waypt_alloc_gc_data(wpt_tmp)->favorite_points = cdatastr.toInt(); + wpt_tmp->AllocGCData()->favorite_points = cdatastr.toInt(); break; case tt_cache_personal_note: - waypt_alloc_gc_data(wpt_tmp)->personal_note = cdatastr; + wpt_tmp->AllocGCData()->personal_note = cdatastr; break; /* diff --git a/gpsbabel/gtm.cc b/gpsbabel/gtm.cc index f98ddd1fc..6f0f82f7c 100644 --- a/gpsbabel/gtm.cc +++ b/gpsbabel/gtm.cc @@ -526,7 +526,7 @@ gtm_read(void) /* Waypoints */ for (i = 0; i != wp_count; i++) { - wpt = waypt_new(); + wpt = new waypoint; wpt->latitude = fread_double(file_in); wpt->longitude = fread_double(file_in); convert_datum(&wpt->latitude, &wpt->longitude); @@ -561,7 +561,7 @@ gtm_read(void) /* Tracklogs */ for (i = 0; i != tr_count; i++) { - wpt = waypt_new(); + wpt = new waypoint; wpt->latitude = fread_double(file_in); wpt->longitude = fread_double(file_in); convert_datum(&wpt->latitude, &wpt->longitude); @@ -595,7 +595,7 @@ gtm_read(void) /* Routes */ for (i = 0; i != rt_count; i++) { - wpt = waypt_new(); + wpt = new waypoint; wpt->latitude = fread_double(file_in); wpt->longitude = fread_double(file_in); convert_datum(&wpt->latitude, &wpt->longitude); diff --git a/gpsbabel/gtrnctr.cc b/gpsbabel/gtrnctr.cc index 10ba61117..ac9de4626 100644 --- a/gpsbabel/gtrnctr.cc +++ b/gpsbabel/gtrnctr.cc @@ -493,7 +493,7 @@ gtc_trk_lap_e(xg_string unused, const QXmlStreamAttributes* unusedattrs) void gtc_trk_pnt_s(xg_string unused, const QXmlStreamAttributes* unusedattrs) { - wpt_tmp = waypt_new(); + wpt_tmp = new waypoint; } void @@ -504,7 +504,7 @@ gtc_trk_pnt_e(xg_string args, const QXmlStreamAttributes* unused) /* Add the first point of an ActivityLap as a waypoint as well as a trackpoint. */ char cbuf[10]; - waypoint* wpt_lap_s = waypt_dupe(wpt_tmp); + waypoint* wpt_lap_s = new waypoint(*wpt_tmp); snprintf(cbuf, sizeof(cbuf), "LAP%03d", lap_ct); wpt_lap_s->shortname = cbuf; waypt_add(wpt_lap_s); @@ -513,7 +513,7 @@ gtc_trk_pnt_e(xg_string args, const QXmlStreamAttributes* unused) track_add_wpt(trk_head, wpt_tmp); } else { - waypt_free(wpt_tmp); + delete wpt_tmp; } wpt_tmp = NULL; @@ -626,7 +626,7 @@ gtc_wpt_crs_s(const QString& args, const QXmlStreamAttributes* unused) gtc_wpt_crs_s(const char* unused, const QXmlStreamAttributes* unusedattrs) #endif { - wpt_tmp = waypt_new(); + wpt_tmp = new waypoint; } void @@ -635,7 +635,7 @@ gtc_wpt_crs_e(xg_string args, const QXmlStreamAttributes* unused) if (wpt_tmp->longitude != 0. && wpt_tmp->latitude != 0.) { waypt_add(wpt_tmp); } else { - waypt_free(wpt_tmp); + delete wpt_tmp; } wpt_tmp = NULL; @@ -644,7 +644,7 @@ gtc_wpt_crs_e(xg_string args, const QXmlStreamAttributes* unused) void gtc_wpt_pnt_s(xg_string unused, const QXmlStreamAttributes* unusedattrs) { - wpt_tmp = waypt_new(); + wpt_tmp = new waypoint; lap_ct++; } @@ -657,7 +657,7 @@ gtc_wpt_pnt_e(xg_string args, const QXmlStreamAttributes* unused) wpt_tmp->shortname = QString().sprintf("LAP%03d", lap_ct); waypt_add(wpt_tmp); } else { - waypt_free(wpt_tmp); + delete wpt_tmp; } wpt_tmp = NULL; diff --git a/gpsbabel/hiketech.cc b/gpsbabel/hiketech.cc index 99bb7bb57..f399e9eca 100644 --- a/gpsbabel/hiketech.cc +++ b/gpsbabel/hiketech.cc @@ -194,7 +194,7 @@ hiketech_write(void) static void ht_wpt_s(xg_string args, const QXmlStreamAttributes* unused) { - wpt_tmp = waypt_new(); + wpt_tmp = new waypoint; } static @@ -256,7 +256,7 @@ void ht_trk_ident(xg_string args, const QXmlStreamAttributes* unused) static void ht_trk_pnt_s(xg_string args, const QXmlStreamAttributes* unused) { - wpt_tmp = waypt_new(); + wpt_tmp = new waypoint; } static diff --git a/gpsbabel/holux.cc b/gpsbabel/holux.cc index 2ba4a5862..4c9a0c57d 100644 --- a/gpsbabel/holux.cc +++ b/gpsbabel/holux.cc @@ -105,7 +105,7 @@ static void data_read(void) /* Get the waypoints */ for (iCount = 0; iCount < iWptNum ; iCount ++) { - wpt_tmp = waypt_new(); + wpt_tmp = new waypoint; iWptIndex = le_read16(&((WPTHDR*)HxWpt)->idx[iCount]); pWptHxTmp = (WPT*)&HxWpt[OFFS_WPT + (sizeof(WPT) * iWptIndex)]; diff --git a/gpsbabel/humminbird.cc b/gpsbabel/humminbird.cc index 08d1ebadc..77a638eac 100644 --- a/gpsbabel/humminbird.cc +++ b/gpsbabel/humminbird.cc @@ -285,7 +285,7 @@ humminbird_read_wpt(gbfile* fin) /* All right! Copy the data to the gpsbabel struct... */ - wpt = waypt_new(); + wpt = new waypoint; // Could probably find a way to eliminate the alloc/copy. char *s = xstrndup(w.name, sizeof(w.name)); @@ -313,7 +313,7 @@ humminbird_read_wpt(gbfile* fin) // that describes a sub-status switch (w.status) { case 0: // Waypoint not used. So why do we have one? - waypt_free(wpt); + delete wpt; break; case 1: // Waypoint permanent. case 2: // Waypoint temporary. @@ -324,7 +324,7 @@ humminbird_read_wpt(gbfile* fin) case 17: // Waypoint group body. case 63: // Waypoint group invalid. default: - waypt_free(wpt); + delete wpt; break; } @@ -368,7 +368,7 @@ humminbird_read_route(gbfile* fin) xfree(s); /* rte->rte_num = hrte.num + 1; only internal number */ } - route_add_wpt(rte, waypt_dupe(wpt)); + route_add_wpt(rte, new waypoint(*wpt)); } } } @@ -434,7 +434,7 @@ humminbird_read_track(gbfile* fin) /* We create one wpt for the info in the header */ - first_wpt = waypt_new(); + first_wpt = new waypoint; g_lat = gudermannian_i1924(accum_north); first_wpt->latitude = geocentric_to_geodetic_hwr(g_lat); first_wpt->longitude = accum_east/EAST_SCALE * 180.0; @@ -443,7 +443,7 @@ humminbird_read_track(gbfile* fin) track_add_wpt(trk, first_wpt); for (i=0 ; ilatitude = geocentric_to_geodetic_hwr(g_lat); first_wpt->longitude = accum_east/EAST_SCALE * 180.0; @@ -562,7 +562,7 @@ humminbird_read_track_old(gbfile* fin) track_add_wpt(trk, first_wpt); for (i=0 ; ilatitude = ('N' == lat_hemi[0] ? 1 : -1) * (lat_deg + (lat_min * 1000 + lat_frac) / 1000.0 / 60); @@ -246,7 +246,7 @@ static void igc_task_rec(const char* rec) // Zero lat and lon indicates an unknown waypoint if (coords_match(wpt->latitude, wpt->longitude, 0.0, 0.0)) { - waypt_free(wpt); + delete wpt; return; } wpt->shortname = short_name; @@ -350,7 +350,7 @@ static void data_read(void) &validity, &pres_alt, &gnss_alt) != 14) { fatal(MYNAME ": fix (B) record parse error\n%s\n", ibuf); } - pres_wpt = waypt_new(); + pres_wpt = new waypoint; pres_wpt->latitude = ('N' == lat_hemi[0] ? 1 : -1) * (lat_deg + (lat_min * 1000 + lat_frac) / 1000.0 / 60); @@ -377,7 +377,7 @@ static void data_read(void) // Add the same waypoint with GNSS altitude to the second // track - gnss_wpt = waypt_dupe(pres_wpt); + gnss_wpt = new waypoint(*pres_wpt); if (gnss_alt) { gnss_valid = 1; diff --git a/gpsbabel/ignrando.cc b/gpsbabel/ignrando.cc index bb8c43bb6..49282db5d 100644 --- a/gpsbabel/ignrando.cc +++ b/gpsbabel/ignrando.cc @@ -111,7 +111,7 @@ ignr_etape_begin(xg_string args, const QXmlStreamAttributes* attrv) { ignr_xml_error((wpt != NULL)); - wpt = waypt_new(); + wpt = new waypoint; } static void diff --git a/gpsbabel/igo8.cc b/gpsbabel/igo8.cc index 7b7d0d83b..19a7700b6 100644 --- a/gpsbabel/igo8.cc +++ b/gpsbabel/igo8.cc @@ -161,7 +161,7 @@ static void igo8_read(void) while (in_point_count && gbfread(&point, sizeof(point), 1, igo8_file_in) > 0) { in_point_count--; - wpt_tmp = waypt_new(); + wpt_tmp = new waypoint; wpt_tmp->latitude = le_read32(&point.lat) / (double)0x800000; wpt_tmp->longitude = le_read32(&point.lon) / (double)0x800000; diff --git a/gpsbabel/ik3d.cc b/gpsbabel/ik3d.cc index 65a5d67e8..e39e2aa2d 100644 --- a/gpsbabel/ik3d.cc +++ b/gpsbabel/ik3d.cc @@ -85,7 +85,7 @@ iktobj_waypt(xg_string args, const QXmlStreamAttributes* attrv) static void iktobj_trkpt(xg_string args, const QXmlStreamAttributes* attrv) { - waypt = waypt_new(); + waypt = new waypoint; iktobj_waypt(args, attrv); track_add_wpt(track, waypt); waypt = NULL; @@ -113,7 +113,7 @@ iktobj_type(xg_string args, const QXmlStreamAttributes* unused) switch (atoi(args)) { #endif case 0: - waypt = waypt_new(); + waypt = new waypoint; break; case 1: track = route_head_alloc(); diff --git a/gpsbabel/interpolate.cc b/gpsbabel/interpolate.cc index a78b538bb..ad800238d 100644 --- a/gpsbabel/interpolate.cc +++ b/gpsbabel/interpolate.cc @@ -97,7 +97,7 @@ interpfilt_process(void) for (timen = time1+interval; timen < wpt->creation_time.toTime_t(); timen += interval) { - waypoint* wpt_new = waypt_dupe(wpt); + waypoint* wpt_new = new waypoint(*wpt); wpt_new->SetCreationTime(timen); #if NEW_STRINGS wpt_new->shortname = QString(); @@ -134,7 +134,7 @@ interpfilt_process(void) for (distn = dist; distn < curdist; distn += dist) { - waypoint* wpt_new = waypt_dupe(wpt); + waypoint* wpt_new = new waypoint(*wpt); wpt_new->SetCreationTime(distn/curdist* (wpt->creation_time.toTime_t() - time1) + time1); #if NEW_STRINGS @@ -164,9 +164,9 @@ interpfilt_process(void) } } if (opt_route) { - route_add_wpt(rte_new, waypt_dupe(wpt)); + route_add_wpt(rte_new, new waypoint(*wpt)); } else { - track_add_wpt(rte_new, waypt_dupe(wpt)); + track_add_wpt(rte_new, new waypoint(*wpt)); } lat1 = wpt->latitude; diff --git a/gpsbabel/itracku.cc b/gpsbabel/itracku.cc index c06469610..5d5145327 100644 --- a/gpsbabel/itracku.cc +++ b/gpsbabel/itracku.cc @@ -292,7 +292,7 @@ static waypoint* to_waypoint(itracku_data_record* d) { waypoint* wp; - wp = waypt_new(); + wp = new waypoint; wp->longitude = deg_min_to_deg(le_read32(d->longitude)); wp->latitude = deg_min_to_deg(le_read32(d->latitude)); wp->SetCreationTime(decode_itracku_time(le_read32(d->creation_time))); @@ -710,7 +710,7 @@ gprmc_parse(char* ibuf) dmy = dmy / 100; tm.tm_mday = dmy; - waypt = waypt_new(); + waypt = new waypoint; WAYPT_SET(waypt, speed, KNOTS_TO_MPS(speed)); diff --git a/gpsbabel/jogmap.cc b/gpsbabel/jogmap.cc index c3e7bfc4d..b8a703782 100644 --- a/gpsbabel/jogmap.cc +++ b/gpsbabel/jogmap.cc @@ -52,7 +52,7 @@ jogmap_markers(xg_string args, const QXmlStreamAttributes* attrv) static void jogmap_marker(xg_string args, const QXmlStreamAttributes* attrv) { - waypoint* wpt = waypt_new(); + waypoint* wpt = new waypoint; if (attrv->hasAttribute("lat")) { wpt->latitude = attrv->value("lat").toString().toDouble(); diff --git a/gpsbabel/jtr.cc b/gpsbabel/jtr.cc index 7452669b5..255b64e8e 100644 --- a/gpsbabel/jtr.cc +++ b/gpsbabel/jtr.cc @@ -213,7 +213,7 @@ jtr_read(void) continue; } - wpt = waypt_new(); + wpt = new waypoint; wpt->latitude = lat; wpt->longitude = lon; diff --git a/gpsbabel/kml.cc b/gpsbabel/kml.cc index 24850fcfe..74a5ce11e 100644 --- a/gpsbabel/kml.cc +++ b/gpsbabel/kml.cc @@ -272,7 +272,7 @@ const char* kml_tags_to_ignore[] = { void wpt_s(xg_string args, const QXmlStreamAttributes* unused) { - wpt_tmp = waypt_new(); + wpt_tmp = new waypoint; wpt_tmp_queued = 0; } @@ -281,7 +281,7 @@ void wpt_e(xg_string args, const QXmlStreamAttributes* unused) if (wpt_tmp_queued) { waypt_add(wpt_tmp); } else { - waypt_free(wpt_tmp); + delete wpt_tmp; } wpt_tmp_queued = 0; } @@ -338,7 +338,7 @@ void trk_coord(xg_string args, const QXmlStreamAttributes* attrv) } track_add_head(trk_head); while ((n = sscanf(CSTR(iargs), "%lf,%lf,%lf%n", &lon, &lat, &alt, &consumed)) > 0) { - trkpt = waypt_new(); + trkpt = new waypoint; trkpt->latitude = lat; trkpt->longitude = lon; @@ -2088,7 +2088,7 @@ kml_wr_position(waypoint* wpt) if (radtometers(gcdist(RAD(wpt->latitude), RAD(wpt->longitude), RAD(newest_posn->latitude), RAD(newest_posn->longitude))) > 50) { - track_add_wpt(posn_trk_head, waypt_dupe(wpt)); + track_add_wpt(posn_trk_head, new waypoint(*wpt)); } else { /* If we haven't move more than our threshold, pretend * we didn't move at all to prevent Earth from jittering diff --git a/gpsbabel/lmx.cc b/gpsbabel/lmx.cc index 462fd744a..7c4dc30ad 100644 --- a/gpsbabel/lmx.cc +++ b/gpsbabel/lmx.cc @@ -338,7 +338,7 @@ lmx_rd_deinit(void) static void lmx_lm_start(xg_string args, const QXmlStreamAttributes* unused) { - wpt_tmp = waypt_new(); + wpt_tmp = new waypoint; } static void diff --git a/gpsbabel/lowranceusr.cc b/gpsbabel/lowranceusr.cc index a566caaa4..fc1728458 100644 --- a/gpsbabel/lowranceusr.cc +++ b/gpsbabel/lowranceusr.cc @@ -481,7 +481,7 @@ lowranceusr_parse_routes(void) /* waypoints */ for (j=0; j < num_legs; j++) { - wpt_tmp = waypt_new(); + wpt_tmp = new waypoint; lowranceusr_parse_waypt(wpt_tmp); route_add_wpt(rte_head, wpt_tmp); } @@ -513,7 +513,7 @@ lowranceusr_parse_icons(void) (void) gbfread(&buff[0], 4, 1, file_in); } else { waypoint* wpt_tmp; - wpt_tmp = waypt_new(); + wpt_tmp = new waypoint; /* position coord lat & long */ wpt_tmp->latitude = lat_mm_to_deg(gbfgetint32(file_in)); @@ -594,7 +594,7 @@ lowranceusr_parse_trails(void) } for (j=0; j < num_section_points; j++, num_trail_points--) { - wpt_tmp = waypt_new(); + wpt_tmp = new waypoint; wpt_tmp->latitude = lat_mm_to_deg(gbfgetint32(file_in)); wpt_tmp->longitude = lon_mm_to_deg(gbfgetint32(file_in)); /* continuous */ @@ -655,7 +655,7 @@ data_read(void) for (i = 0; i < NumWaypoints; i++) { waypoint* wpt_tmp; - wpt_tmp = waypt_new(); + wpt_tmp = new waypoint; /* Object num */ object_num = gbfgetint16(file_in); diff --git a/gpsbabel/lowranceusr4.cc b/gpsbabel/lowranceusr4.cc index 8761b4d5a..ff82f5fa1 100644 --- a/gpsbabel/lowranceusr4.cc +++ b/gpsbabel/lowranceusr4.cc @@ -359,7 +359,7 @@ lowranceusr4_parse_waypoints(void) for (i = 0; i < num_waypts; ++i) { waypoint* wpt_tmp; - wpt_tmp = waypt_new(); + wpt_tmp = new waypoint; lowranceusr4_fsdata* fsdata = lowranceusr4_alloc_fsdata(); fs_chain_add(&(wpt_tmp->fs), (format_specific_data*) fsdata); @@ -564,7 +564,7 @@ lowranceusr4_parse_routes(void) printf(MYNAME " parse_routes: added wpt %s to route %s\n", CSTRc(wpt_tmp->shortname), CSTRc(rte_head->rte_name)); } - route_add_wpt(rte_head, waypt_dupe(wpt_tmp)); + route_add_wpt(rte_head, new waypoint(*wpt_tmp)); } } @@ -683,7 +683,7 @@ lowranceusr4_parse_trails(void) } for (j = 0; j < num_trail_pts; ++j) { - wpt_tmp = waypt_new(); + wpt_tmp = new waypoint; /* Some unknown bytes */ gbfgetint16(file_in); diff --git a/gpsbabel/maggeo.cc b/gpsbabel/maggeo.cc index 0093b76f6..9064fa7a2 100644 --- a/gpsbabel/maggeo.cc +++ b/gpsbabel/maggeo.cc @@ -101,8 +101,8 @@ maggeo_read(void) buff += 9; /* skip field no. 1 */ fld = 1; - wpt_tmp = waypt_new(); - gcdata = waypt_alloc_gc_data(wpt_tmp); + wpt_tmp = new waypoint; + gcdata = wpt_tmp->AllocGCData(); while ((s = csv_lineparse(buff, ",", "", fld++))) { buff = NULL; diff --git a/gpsbabel/magproto.cc b/gpsbabel/magproto.cc index a2e9d4f52..3fc9b76cd 100644 --- a/gpsbabel/magproto.cc +++ b/gpsbabel/magproto.cc @@ -974,7 +974,7 @@ mag_trkparse(char* trkmsg) struct tm tm; waypoint* waypt; - waypt = waypt_new(); + waypt = new waypoint; memset(&tm, 0, sizeof(tm)); @@ -1155,7 +1155,7 @@ mag_rteparse(char* rtemsg) #else if (strcmp(waypt->shortname, re->wpt_name) == 0) { #endif - waypoint* wpt = waypt_dupe(waypt); + waypoint* wpt = new waypoint(*waypt); route_add_wpt(rte_head, wpt); break; } @@ -1235,7 +1235,7 @@ mag_wptparse(char* trkmsg) descr[0] = 0; icon_token[0] = 0; - waypt = waypt_new(); + waypt = new waypoint; sscanf(trkmsg,"$PMGNWPL,%lf,%c,%lf,%c,%d,%c,%[^,],%[^,]", &latdeg,&latdir, diff --git a/gpsbabel/main.cc b/gpsbabel/main.cc index 7453a4dcd..1bb72abd8 100644 --- a/gpsbabel/main.cc +++ b/gpsbabel/main.cc @@ -695,7 +695,7 @@ main(int argc, char* argv[]) if (tracking_status.request_terminate) { if (wpt) { - waypt_free(wpt); + delete wpt; } break; } @@ -708,7 +708,7 @@ main(int argc, char* argv[]) /* Just print to screen */ waypt_disp(wpt); } - waypt_free(wpt); + delete wpt; } } if (ivecs->position_ops.rd_deinit) { diff --git a/gpsbabel/mapasia.cc b/gpsbabel/mapasia.cc index f4259ac9d..5166e7dc1 100644 --- a/gpsbabel/mapasia.cc +++ b/gpsbabel/mapasia.cc @@ -110,7 +110,7 @@ tr7_read(void) continue; } - wpt = waypt_new(); + wpt = new waypoint; wpt->latitude = lat; wpt->longitude = lon; @@ -123,12 +123,12 @@ tr7_read(void) #if 0 /* unsure, not validated items */ wpt->fix = buff[TR7_S_FIX]; if (buff[TR7_S_VALID] != 'A') { - waypt_free(wpt); + delete wpt; continue; } #endif if (waypt_speed(prev, wpt) > 9999.9) { /* filter out some bad trackpoints */ - waypt_free(wpt); + delete wpt; continue; } diff --git a/gpsbabel/mapbar_track.cc b/gpsbabel/mapbar_track.cc index 05f35abfd..aa152a310 100644 --- a/gpsbabel/mapbar_track.cc +++ b/gpsbabel/mapbar_track.cc @@ -70,7 +70,7 @@ read_waypoint(void) int longitude = gbfgetint32(fin); int latitude = gbfgetint32(fin); - waypoint* ret = waypt_new(); + waypoint* ret = new waypoint; ret->latitude = double(latitude)/DIV_RATE; ret->longitude = double(longitude)/DIV_RATE; diff --git a/gpsbabel/mapsend.cc b/gpsbabel/mapsend.cc index 4c3103576..91623c5a0 100644 --- a/gpsbabel/mapsend.cc +++ b/gpsbabel/mapsend.cc @@ -121,7 +121,7 @@ mapsend_wpt_read(void) wpt_count = gbfgetint32(mapsend_file_in); while (wpt_count--) { - wpt_tmp = waypt_new(); + wpt_tmp = new waypoint; wpt_tmp->shortname = gbfgetpstr(mapsend_file_in); wpt_tmp->description = gbfgetpstr(mapsend_file_in); @@ -162,7 +162,7 @@ mapsend_wpt_read(void) wpt_count = gbfgetint32(mapsend_file_in); while (wpt_count--) { - wpt_tmp = waypt_new(); + wpt_tmp = new waypoint; /* waypoint name */ wpt_tmp->shortname = gbfgetpstr(mapsend_file_in); @@ -202,7 +202,7 @@ mapsend_track_read(void) trk_count = gbfgetuint32(mapsend_file_in); while (trk_count--) { - wpt_tmp = waypt_new(); + wpt_tmp = new waypoint; wpt_tmp->longitude = gbfgetdbl(mapsend_file_in); wpt_tmp->latitude = -gbfgetdbl(mapsend_file_in); diff --git a/gpsbabel/mapsource.cc b/gpsbabel/mapsource.cc index 87ae93627..491e8f434 100644 --- a/gpsbabel/mapsource.cc +++ b/gpsbabel/mapsource.cc @@ -126,7 +126,7 @@ mps_wpt_q_deinit(queue* whichQueue) QUEUE_FOR_EACH(whichQueue, elem, tmp) { waypoint* q = (waypoint*) dequeue(elem); - waypt_free(q); + delete q; } } @@ -156,7 +156,7 @@ mps_find_wpt_q_by_name(const queue* whichQueue, const QString& name) void mps_wpt_q_add(const queue* whichQueue, const waypoint* wpt) { - waypoint* written_wpt = waypt_dupe(wpt); + waypoint* written_wpt = new waypoint(*wpt); ENQUEUE_TAIL(whichQueue, &written_wpt->Q); } @@ -527,7 +527,7 @@ mps_waypoint_r(gbfile* mps_file, int mps_ver, waypoint** wpt, unsigned int* mpsc double mps_proximity = unknown_alt; double mps_depth = unknown_alt; - thisWaypoint = waypt_new(); + thisWaypoint = new waypoint; *wpt = thisWaypoint; mps_readstr(mps_file, wptname, sizeof(wptname)); @@ -856,7 +856,7 @@ mps_waypoint_w_uniqloc_wrapper(waypoint* wpt) ((wpt->longitude - wptfound->longitude) != 0)) { /* Not the same lat lon, so rename and add */ newName = mkshort(written_wpt_mkshort_handle, wpt->shortname); - wptfound = waypt_dupe(wpt); + wptfound = new waypoint(*wpt); xfree(wptfound->shortname); wptfound->shortname = newName; mps_waypoint_w(mps_file_out, mps_ver_out, wptfound, (1==0)); @@ -1008,18 +1008,18 @@ mps_route_r(gbfile* mps_file, int mps_ver, route_head** rte) tempWpt = find_waypt_by_name(wptname); if (tempWpt != NULL) { - thisWaypoint = waypt_dupe(tempWpt); + thisWaypoint = new waypoint(*tempWpt); } else { tempWpt = mps_find_wpt_q_by_name(&read_route_wpt_head, wptname); if (tempWpt != NULL) { - thisWaypoint = waypt_dupe(tempWpt); + thisWaypoint = new waypoint(*tempWpt); } else { /* should never reach here, but we do need a fallback position */ #ifdef MPS_DEBUG fprintf(stderr, "mps_route_r: reached the point we never should\n"); #endif - thisWaypoint = waypt_new(); + thisWaypoint = new waypoint; thisWaypoint->shortname = wptname; thisWaypoint->latitude = GPS_Math_Semi_To_Deg(lat); thisWaypoint->longitude = GPS_Math_Semi_To_Deg(lon); @@ -1095,15 +1095,15 @@ mps_route_r(gbfile* mps_file, int mps_ver, route_head** rte) tempWpt = find_waypt_by_name(wptname); if (tempWpt != NULL) { - thisWaypoint = waypt_dupe(tempWpt); + thisWaypoint = new waypoint(*tempWpt); } else { tempWpt = mps_find_wpt_q_by_name(&read_route_wpt_head, wptname); if (tempWpt != NULL) { - thisWaypoint = waypt_dupe(tempWpt); + thisWaypoint = new waypoint(*tempWpt); } else { /* should never reach here, but we do need a fallback position */ - thisWaypoint = waypt_new(); + thisWaypoint = new waypoint; thisWaypoint->shortname = wptname; thisWaypoint->latitude = GPS_Math_Semi_To_Deg(lat); thisWaypoint->longitude = GPS_Math_Semi_To_Deg(lon); @@ -1553,7 +1553,7 @@ mps_track_r(gbfile* mps_file, int mps_ver, route_head** trk) gbfseek(mps_file, 8, SEEK_CUR); } - thisWaypoint = waypt_new(); + thisWaypoint = new waypoint; thisWaypoint->latitude = GPS_Math_Semi_To_Deg(lat); thisWaypoint->longitude = GPS_Math_Semi_To_Deg(lon); thisWaypoint->SetCreationTime(dateTime); @@ -1749,14 +1749,14 @@ mps_read(void) fprintf(stderr,"Lost sync with the file reading waypoint - %s\n", wpt->shortname); #endif gbfseek(mps_file_in, mpsFileInPos + reclen, SEEK_SET); - waypt_free(wpt); + delete wpt; } else { /* only add to the "real" list if a "user" waypoint otherwise add to the private list */ if (mpsWptClass == MPSDEFAULTWPTCLASS) { waypt_add(wpt); } else { mps_wpt_q_add(&read_route_wpt_head, wpt); - waypt_free(wpt); + delete wpt; } #ifdef DUMP_ICON_TABLE printf("\t{ %4u, \"%s\" },\n", icon, wpt->shortname); @@ -1905,7 +1905,7 @@ mps_write(void) since we're here because the user didn't request waypoints, this should be acceptable */ mps_waypoint_r(mps_file_temp, mps_ver_temp, &wpt, &mpsWptClass); mps_wpt_q_add(&written_wpt_head, wpt); - waypt_free(wpt); + delete wpt; /* now return to the start of the waypoint data to do a "clean" copy */ gbfseek(mps_file_temp, tempFilePos, SEEK_SET); @@ -1941,7 +1941,7 @@ mps_write(void) if (mpsWptClass == MPSDEFAULTWPTCLASS) { waypt_add(wpt); } else { - waypt_free(wpt); + delete wpt; } } else { break; diff --git a/gpsbabel/mmo.cc b/gpsbabel/mmo.cc index b886905ff..4a0eb4ce6 100644 --- a/gpsbabel/mmo.cc +++ b/gpsbabel/mmo.cc @@ -324,7 +324,7 @@ mmo_get_waypt(mmo_data_t* data) if (data->refct == 1) { return (waypoint*)data->data; } else { - return waypt_dupe((waypoint*)data->data); + return new waypoint(*(waypoint*)data->data); } } @@ -335,7 +335,7 @@ mmo_free_object(mmo_data_t* data) xfree(data->name); } if ((data->type == wptdata) && (data->refct == 0)) { - waypt_free((waypoint*)data->data); + delete (waypoint*)data->data; } xfree(data); } @@ -460,7 +460,7 @@ mmo_read_CObjWaypoint(mmo_data_t* data) DBG((sobj, "name = \"%s\" [ visible=%s, id=0x%04X ]\n", data->name, data->visible ? "yes" : "NO", data->objid)); - data->data = wpt = waypt_new(); + data->data = wpt = new waypoint; wpt->shortname = QString::fromLatin1(data->name); time = data->mtime; @@ -635,7 +635,7 @@ mmo_read_CObjRoute(mmo_data_t* data) /* FIXME: At this point this waypoint maybe not fully loaded (initialized) !!! We need a final procedure to handle this !!! */ if (! tmp->loaded) { - wpt = waypt_new(); + wpt = new waypoint; wpt->latitude = 0; wpt->longitude = 0; xasprintf(&wpt->shortname, "\01%p", tmp); @@ -690,7 +690,7 @@ mmo_read_CObjTrack(mmo_data_t* data) waypoint* wpt; char unk; - wpt = waypt_new(); + wpt = new waypoint; wpt->latitude = gbfgetdbl(fin); wpt->longitude = gbfgetdbl(fin); diff --git a/gpsbabel/mtk_locus.cc b/gpsbabel/mtk_locus.cc index e977538a2..a04ec73db 100644 --- a/gpsbabel/mtk_locus.cc +++ b/gpsbabel/mtk_locus.cc @@ -436,7 +436,7 @@ process_pmtklox() } if (global_opts.masked_objective & TRKDATAMASK) { - trkpt = waypt_new(); + trkpt = new waypoint; trkpt->SetCreationTime(timestamp); trkpt->latitude = latitude; trkpt->longitude = longitude; @@ -448,7 +448,7 @@ process_pmtklox() } if (global_opts.masked_objective & WPTDATAMASK) { - waypt = waypt_new(); + waypt = new waypoint; waypt->SetCreationTime(timestamp); waypt->latitude = latitude; waypt->longitude = longitude; diff --git a/gpsbabel/mtk_logger.cc b/gpsbabel/mtk_logger.cc index 748144e4d..a70713b49 100644 --- a/gpsbabel/mtk_logger.cc +++ b/gpsbabel/mtk_logger.cc @@ -747,7 +747,7 @@ mtk_retry: static route_head* trk_head = NULL; static int add_trackpoint(int idx, unsigned long bmask, struct data_item* itm) { - waypoint* trk = waypt_new(); + waypoint* trk = new waypoint; if (global_opts.masked_objective& TRKDATAMASK && (trk_head == NULL || (mtk_info.track_event & MTK_EVT_START))) { char spds[50]; @@ -826,7 +826,7 @@ static int add_trackpoint(int idx, unsigned long bmask, struct data_item* itm) */ if ((trk->fix == fix_unknown || trk->fix == fix_none) && trk->latitude - 90.0 < .000001 && trk->longitude < 0.000001) { - waypt_free(trk); + delete trk; return -1; } } @@ -842,7 +842,7 @@ static int add_trackpoint(int idx, unsigned long bmask, struct data_item* itm) ) ) { /* Button press -- create waypoint, start count at 1 */ - waypoint* w = waypt_dupe(trk); + waypoint* w = new waypoint(*trk); w->shortname = QString().sprintf("WP%06d", waypt_count()+1); waypt_add(w); diff --git a/gpsbabel/navicache.cc b/gpsbabel/navicache.cc index 9f9ecc62f..61a327569 100644 --- a/gpsbabel/navicache.cc +++ b/gpsbabel/navicache.cc @@ -100,9 +100,9 @@ static void NaviReadCache(const QXmlStreamReader& reader) { const QXmlStreamAttributes a = reader.attributes(); - waypoint* wpt_tmp = waypt_new(); + waypoint* wpt_tmp = new waypoint; geocache_data* gc_data; - gc_data = waypt_alloc_gc_data(wpt_tmp); + gc_data = wpt_tmp->AllocGCData(); if (a.hasAttribute("cache_id")) { int n = a.value("cache_id").toString().toInt(); QString fn = QString("N%1").arg(n, 5, 16, QChar('0')); @@ -154,7 +154,7 @@ NaviReadCache(const QXmlStreamReader& reader) if (a.hasAttribute("retired")) { if (a.value("terrain").toString() == "yes" && noretired) { - waypt_free(wpt_tmp); + delete wpt_tmp; return; } } diff --git a/gpsbabel/naviguide.cc b/gpsbabel/naviguide.cc index ca89cb8db..7352f1751 100644 --- a/gpsbabel/naviguide.cc +++ b/gpsbabel/naviguide.cc @@ -383,7 +383,7 @@ data_read(void) for (int n = 0; n < nof_wp; ++n) { - waypoint* wpt_tmp = waypt_new(); + waypoint* wpt_tmp = new waypoint; /* Read waypoint data */ diff --git a/gpsbabel/navilink.cc b/gpsbabel/navilink.cc index 48b961d00..34497ddf6 100644 --- a/gpsbabel/navilink.cc +++ b/gpsbabel/navilink.cc @@ -194,7 +194,7 @@ free_waypoints(waypoint** waypts) for (wayptp = waypts; wayptp < waypts + MAX_WAYPOINTS; wayptp++) { if (*wayptp) { - waypt_free(*wayptp); + delete *wayptp; } } @@ -410,7 +410,7 @@ decode_waypoint_id(const unsigned char* buffer) static waypoint* decode_waypoint(const unsigned char* buffer) { - waypoint* waypt = waypt_new(); + waypoint* waypt = new waypoint; decode_position(buffer + 12, waypt); char* s = xstrdup((char*)buffer + 4); @@ -442,7 +442,7 @@ encode_waypoint(const waypoint* waypt, unsigned char* buffer) static waypoint* decode_trackpoint(const unsigned char* buffer) { - waypoint* waypt = waypt_new(); + waypoint* waypt = new waypoint; decode_position(buffer + 12, waypt); waypt->SetCreationTime(decode_datetime(buffer + 22)); @@ -704,7 +704,7 @@ serial_read_routes(waypoint** waypts) } else if (waypts[id] == NULL) { fatal(MYNAME ": Non-existent waypoint in route\n"); } else { - route_add_wpt(route, waypt_dupe(waypts[id])); + route_add_wpt(route, new waypoint(*waypts[id])); } } } @@ -731,7 +731,7 @@ serial_write_route_point(const waypoint* waypt) if (w == MAX_WAYPOINTS) { w = serial_write_waypoint_packet(waypt); - route_waypts[w] = waypt_dupe(waypt); + route_waypts[w] = new waypoint(*waypt); } route_ids[route_id_ptr++] = w; @@ -850,7 +850,7 @@ waypoint* navilink_decode_logpoint(const unsigned char* buffer) { waypoint* waypt = NULL; - waypt = waypt_new(); + waypt = new waypoint; waypt->hdop = ((unsigned char)buffer[0]) * 0.2f; waypt->sat = buffer[1]; diff --git a/gpsbabel/navitel.cc b/gpsbabel/navitel.cc index 7407a3e27..80e03a79f 100644 --- a/gpsbabel/navitel.cc +++ b/gpsbabel/navitel.cc @@ -62,7 +62,7 @@ navitel_read_track(void) lon = gbfgetint32(fin); lat = gbfgetint32(fin); - wpt = waypt_new(); + wpt = new waypoint; wpt->latitude = GPS_Math_Semi_To_Deg(lat & 0x7FFFFFFF); wpt->longitude = GPS_Math_Semi_To_Deg(lon); diff --git a/gpsbabel/netstumbler.cc b/gpsbabel/netstumbler.cc index d9e43deed..5c07feccc 100644 --- a/gpsbabel/netstumbler.cc +++ b/gpsbabel/netstumbler.cc @@ -209,7 +209,7 @@ data_read(void) continue; } - wpt_tmp = waypt_new(); + wpt_tmp = new waypoint; if (stealth) { if (!snmac) { diff --git a/gpsbabel/nmea.cc b/gpsbabel/nmea.cc index 0ed98b044..588e38553 100644 --- a/gpsbabel/nmea.cc +++ b/gpsbabel/nmea.cc @@ -251,7 +251,7 @@ nmea_release_wpt(waypoint* wpt) /* This waypoint isn't queued. Release it, because we don't have any reference to this waypoint (! memory leak !) */ - waypt_free(wpt); + delete wpt; } } @@ -405,7 +405,7 @@ gpgll_parse(char* ibuf) hms = hms / 100; tm.tm_hour = hms % 100; - waypt = waypt_new(); + waypt = new waypoint; nmea_set_waypoint_time(waypt, &tm, fsec); @@ -466,7 +466,7 @@ gpgga_parse(char* ibuf) hms = hms / 100; tm.tm_hour = (long) hms % 100; - waypt = waypt_new(); + waypt = new waypoint; nmea_set_waypoint_time(waypt, &tm, fsec); @@ -581,13 +581,13 @@ gprmc_parse(char* ibuf) } /* This point is both a waypoint and a trackpoint. */ if (amod_waypoint) { - waypt_add(waypt_dupe(curr_waypt)); + waypt_add(new waypoint(*curr_waypt)); amod_waypoint = 0; } return; } - waypt = waypt_new(); + waypt = new waypoint; WAYPT_SET(waypt, speed, KNOTS_TO_MPS(speed)); @@ -610,7 +610,7 @@ gprmc_parse(char* ibuf) /* This point is both a waypoint and a trackpoint. */ if (amod_waypoint) { - waypt_add(waypt_dupe(waypt)); + waypt_add(new waypoint(*waypt)); amod_waypoint = 0; } } @@ -628,7 +628,7 @@ gpwpl_parse(char* ibuf) &lngdeg,&lngdir, sname); - waypt = waypt_new(); + waypt = new waypoint; if (latdir == 'S') { latdeg = -latdeg; @@ -800,7 +800,7 @@ pcmpt_parse(char* ibuf) } if (lat || lon) { - curr_waypt = waypt_new(); + curr_waypt = new waypoint; curr_waypt->longitude = pcmpt_deg(lon); curr_waypt->latitude = pcmpt_deg(lat); diff --git a/gpsbabel/nmn4.cc b/gpsbabel/nmn4.cc index ff70b316b..0d8afc53c 100644 --- a/gpsbabel/nmn4.cc +++ b/gpsbabel/nmn4.cc @@ -123,7 +123,7 @@ nmn4_read_data(void) /* for a quiet compiler */ zip1 = zip2 = city = street = number = QString(); - wpt = waypt_new(); + wpt = new waypoint; column = -1; c = csv_lineparse(str, "|", "", column++); diff --git a/gpsbabel/osm.cc b/gpsbabel/osm.cc index 1018af980..b7c161881 100644 --- a/gpsbabel/osm.cc +++ b/gpsbabel/osm.cc @@ -472,7 +472,7 @@ osm_node_end(xg_string args, const QXmlStreamAttributes* unused) if (wpt->wpt_flags.fmt_use) { waypt_add(wpt); } else { - waypt_free(wpt); + delete wpt; } wpt = NULL; } @@ -482,7 +482,7 @@ osm_node_end(xg_string args, const QXmlStreamAttributes* unused) static void osm_node(xg_string args, const QXmlStreamAttributes* attrv) { - wpt = waypt_new(); + wpt = new waypoint; if (attrv->hasAttribute("id")) { QString atstr = attrv->value("id").toString(); @@ -597,7 +597,7 @@ osm_way_nd(xg_string args, const QXmlStreamAttributes* attrv) if (waypoints.contains(atstr)) { ctmp = waypoints.value(atstr); - tmp = waypt_dupe(ctmp); + tmp = new waypoint(*ctmp); route_add_wpt(rte, tmp); } else { warning(MYNAME ": Way reference id \"%s\" wasn't listed under nodes!\n", CSTR(atstr)); diff --git a/gpsbabel/overlay.cc b/gpsbabel/overlay.cc index ae19f5b7e..4a70116d2 100644 --- a/gpsbabel/overlay.cc +++ b/gpsbabel/overlay.cc @@ -362,7 +362,7 @@ static void ovl_read(void) switch (aktTyp) { #ifdef WITH_BITMAP case 1: // Bitmap - wpt = waypt_new(); + wpt = new waypoint; wpt->latitude = aktY; wpt->longitude = aktX; wpt->altitude = 0.0; @@ -374,7 +374,7 @@ static void ovl_read(void) isSection = SECTION_SYMBOL; break; case 3: // Linie - wpt = waypt_new(); + wpt = new waypoint; wpt->latitude = aktY; wpt->longitude = aktX; wpt->altitude = 0.0; diff --git a/gpsbabel/ozi.cc b/gpsbabel/ozi.cc index 7ee7136be..a95bc602a 100644 --- a/gpsbabel/ozi.cc +++ b/gpsbabel/ozi.cc @@ -779,7 +779,7 @@ data_read(void) if (buff.contains(',')) { bool ozi_fsdata_used = false; ozi_fsdata* fsdata = ozi_alloc_fsdata(); - wpt_tmp = waypt_new(); + wpt_tmp = new waypoint; /* data delimited by commas, possibly enclosed in quotes. */ char* orig_s = xstrdup(CSTR(buff)); @@ -820,7 +820,7 @@ data_read(void) ozi_convert_datum(wpt_tmp); track_add_wpt(trk_head, wpt_tmp); } else { - waypt_free(wpt_tmp); + delete wpt_tmp; } break; case rtedata: @@ -829,10 +829,10 @@ data_read(void) if (!header) { route_add_wpt(rte_head, wpt_tmp); } else { - waypt_free(wpt_tmp); + delete wpt_tmp; } } else { - waypt_free(wpt_tmp); + delete wpt_tmp; } break; case wptdata: @@ -844,7 +844,7 @@ data_read(void) ozi_convert_datum(wpt_tmp); waypt_add(wpt_tmp); } else { - waypt_free(wpt_tmp); + delete wpt_tmp; } break; case posndata: diff --git a/gpsbabel/pcx.cc b/gpsbabel/pcx.cc index 8a72fc8c8..5f9de4aac 100644 --- a/gpsbabel/pcx.cc +++ b/gpsbabel/pcx.cc @@ -153,7 +153,7 @@ data_read(void) name[sizeof(name)-1] = '\0'; desc[sizeof(desc)-1] = '\0'; - wpt_tmp = waypt_new(); + wpt_tmp = new waypoint; wpt_tmp->altitude = alt; cp = lrtrim(name); if (*cp != '\0') { @@ -184,7 +184,7 @@ data_read(void) wpt_tmp->latitude = ddmm2degrees(lat); } if (route != NULL) { - route_add_wpt(route, waypt_dupe(wpt_tmp)); + route_add_wpt(route, new waypoint(*wpt_tmp)); } waypt_add(wpt_tmp); points++; @@ -253,7 +253,7 @@ data_read(void) if (tm.tm_year < 70) { tm.tm_year += 100; } - wpt_tmp = waypt_new(); + wpt_tmp = new waypoint; wpt_tmp->SetCreationTime(mkgmtime(&tm)); if (read_as_degrees) { wpt_tmp->longitude = lon; diff --git a/gpsbabel/pocketfms_bc.cc b/gpsbabel/pocketfms_bc.cc index fc1d4bcf9..aeaf9ee54 100644 --- a/gpsbabel/pocketfms_bc.cc +++ b/gpsbabel/pocketfms_bc.cc @@ -104,7 +104,7 @@ read_tracks(void) tm.tm_min = le_readu16(&bc.minute); tm.tm_sec = le_readu16(&bc.second); - wpt = waypt_new(); + wpt = new waypoint; wpt->latitude = le_read_float(&bc.latitude); wpt->longitude = le_read_float(&bc.longitude); wpt->altitude = FEET_TO_METERS(le_read_float(&bc.altitude)); diff --git a/gpsbabel/pocketfms_fp.cc b/gpsbabel/pocketfms_fp.cc index 83d0bc5b1..f5eff59b5 100644 --- a/gpsbabel/pocketfms_fp.cc +++ b/gpsbabel/pocketfms_fp.cc @@ -88,12 +88,12 @@ wr_init(const char* fname) void wpt_s(xg_string args, const QXmlStreamAttributes* unused) { if (isFirst == 1) { - wpt_from = waypt_new(); + wpt_from = new waypoint; route = route_head_alloc(); route->rte_desc="PocketFMS flightplan"; route_add_head(route); } - wpt_to = waypt_new(); + wpt_to = new waypoint; } void wpt_e(xg_string args, const QXmlStreamAttributes* unused) @@ -101,14 +101,14 @@ void wpt_e(xg_string args, const QXmlStreamAttributes* unused) if (isFirst == 1) { route_add_wpt(route, wpt_from); if (doing_wpts) { - waypt_add(waypt_dupe(wpt_from)); + waypt_add(new waypoint(*wpt_from)); } wpt_from = NULL; isFirst = 0; } route_add_wpt(route, wpt_to); if (doing_wpts) { - waypt_add(waypt_dupe(wpt_to)); + waypt_add(new waypoint(*wpt_to)); } wpt_to = NULL; } diff --git a/gpsbabel/pocketfms_wp.cc b/gpsbabel/pocketfms_wp.cc index 2521f9220..656fe6ee6 100644 --- a/gpsbabel/pocketfms_wp.cc +++ b/gpsbabel/pocketfms_wp.cc @@ -65,7 +65,7 @@ data_read(void) break; } linecount++; - wpt = waypt_new(); + wpt = new waypoint; s = buff; s = csv_lineparse(s, "\\w", "", linecount); if (!s) { diff --git a/gpsbabel/polygon.cc b/gpsbabel/polygon.cc index b6a334a53..c926ad14c 100644 --- a/gpsbabel/polygon.cc +++ b/gpsbabel/polygon.cc @@ -332,7 +332,7 @@ polygon_process(void) } if (((ed->state & INSIDE) == OUTSIDE) == (exclopt == NULL)) { waypt_del(wp); - waypt_free(wp); + delete wp; } xfree(ed); } diff --git a/gpsbabel/position.cc b/gpsbabel/position.cc index 51267b8ce..28abf77f2 100644 --- a/gpsbabel/position.cc +++ b/gpsbabel/position.cc @@ -115,7 +115,7 @@ position_runqueue(queue* q, int nelems, int qtype) switch (qtype) { case wptdata: waypt_del(comp[j]); - waypt_free(comp[j]); + delete comp[j]; break; case trkdata: track_del_wpt(cur_rte, comp[j]); @@ -145,7 +145,7 @@ position_runqueue(queue* q, int nelems, int qtype) default: break; } - waypt_free(comp[i]); + delete comp[i]; } } } diff --git a/gpsbabel/psitrex.cc b/gpsbabel/psitrex.cc index bc5fdacb3..ce52ffdcd 100644 --- a/gpsbabel/psitrex.cc +++ b/gpsbabel/psitrex.cc @@ -301,7 +301,7 @@ psit_waypoint_r(gbfile* psit_file, waypoint** wpt) waypoint* thisWaypoint; if (strlen(psit_current_token) > 0) { - thisWaypoint = waypt_new(); + thisWaypoint = new waypoint; thisWaypoint->latitude = atof(psit_current_token); @@ -423,7 +423,7 @@ psit_route_r(gbfile* psit_file, route_head** rte) while (psit_isKnownToken(psit_current_token) != 0) { if (strlen(psit_current_token) > 0) { - thisWaypoint = waypt_new(); + thisWaypoint = new waypoint; thisWaypoint->latitude = atof(psit_current_token); @@ -568,7 +568,7 @@ psit_track_r(gbfile* psit_file, route_head** trk) while (psit_isKnownToken(psit_current_token) != 0) { if (strlen(psit_current_token) > 0) { - thisWaypoint = waypt_new(); + thisWaypoint = new waypoint; thisWaypoint->latitude = atof(psit_current_token); diff --git a/gpsbabel/radius.cc b/gpsbabel/radius.cc index 9bfa1b8b4..34b5c9446 100644 --- a/gpsbabel/radius.cc +++ b/gpsbabel/radius.cc @@ -132,7 +132,7 @@ radius_process(void) if ((dist >= pos_dist) == (exclopt == NULL)) { waypt_del(waypointp); - waypt_free(waypointp); + delete waypointp; continue; } diff --git a/gpsbabel/random.cc b/gpsbabel/random.cc index da85120b5..9c1ef3c01 100644 --- a/gpsbabel/random.cc +++ b/gpsbabel/random.cc @@ -145,7 +145,7 @@ random_read(void) waypoint* wpt; garmin_fs_t* gmsd; - wpt = waypt_new(); + wpt = new waypoint; gmsd = garmin_fs_alloc(-1); fs_chain_add(&wpt->fs, (format_specific_data*) gmsd); diff --git a/gpsbabel/raymarine.cc b/gpsbabel/raymarine.cc index b3a1fa6e5..16b212535 100644 --- a/gpsbabel/raymarine.cc +++ b/gpsbabel/raymarine.cc @@ -207,7 +207,7 @@ raymarine_read(void) break; } - wpt = waypt_new(); + wpt = new waypoint; wpt->shortname = name; wpt->latitude = atof(lat); wpt->longitude = atof(lon); @@ -263,7 +263,7 @@ raymarine_read(void) fatal(MYNAME ": No associated waypoint for route point %s (Route %s)!\n", str, CSTRc(rte->rte_name)); - route_add_wpt(rte, waypt_dupe(wpt)); + route_add_wpt(rte, new waypoint(*wpt)); } } } diff --git a/gpsbabel/route.cc b/gpsbabel/route.cc index ec348e589..ac2eba0d4 100644 --- a/gpsbabel/route.cc +++ b/gpsbabel/route.cc @@ -422,7 +422,7 @@ route_copy(int* dst_count, int* dst_wpt_count, queue** dst, queue* src) rte_new->rte_num = rte_old->rte_num; any_route_add_head(rte_new, *dst); QUEUE_FOR_EACH(&rte_old->waypoint_list, elem2, tmp2) { - any_route_add_wpt(rte_new, waypt_dupe((waypoint*)elem2), dst_wpt_count, 0, RPT, 3); + any_route_add_wpt(rte_new, new waypoint(*(waypoint*)elem2), dst_wpt_count, 0, RPT, 3); } (*dst_count)++; } diff --git a/gpsbabel/saroute.cc b/gpsbabel/saroute.cc index ae628f521..868689d1a 100644 --- a/gpsbabel/saroute.cc +++ b/gpsbabel/saroute.cc @@ -205,7 +205,7 @@ my_read(void) lon = (0x80000000UL - le_read32(&latlon->lat)) / (double)(0x800000); - wpt_tmp = waypt_new(); + wpt_tmp = new waypoint; wpt_tmp->latitude = lat; wpt_tmp->longitude = -lon; if (control) { @@ -363,7 +363,7 @@ my_read(void) double lat; double lon; - wpt_tmp = waypt_new(); + wpt_tmp = new waypoint; lat = (0x80000000UL - le_read32(&latlon->lat)) / @@ -425,10 +425,10 @@ my_read(void) if (old_track_head) { if (timesynth) { track_add_wpt(old_track_head, - waypt_dupe(wpt_tmp)); + new waypoint(*wpt_tmp)); } else { route_add_wpt(old_track_head, - waypt_dupe(wpt_tmp)); + new waypoint(*wpt_tmp)); } old_track_head = NULL; } diff --git a/gpsbabel/sbn.cc b/gpsbabel/sbn.cc index d9aba596a..df51d28b2 100644 --- a/gpsbabel/sbn.cc +++ b/gpsbabel/sbn.cc @@ -240,7 +240,7 @@ static waypoint* decode_sbn_record(unsigned char* buffer) { waypoint* waypt = NULL; - waypt = waypt_new(); + waypt = new waypoint; if (is_sbn_valid(buffer)) { waypt->fix = decode_sbn_mode(buffer + 3); diff --git a/gpsbabel/shape.cc b/gpsbabel/shape.cc index 91d20ddca..87ea24ac8 100644 --- a/gpsbabel/shape.cc +++ b/gpsbabel/shape.cc @@ -172,7 +172,7 @@ my_read(void) routehead->rte_name = name; route_add_head(routehead); for (j = 0; j < shp->nVertices; j++) { - wpt = waypt_new(); + wpt = new waypoint; wpt->latitude = shp->padfY[j]; wpt->longitude = shp->padfX[j]; wpt->altitude = shp->padfZ[j]; @@ -182,7 +182,7 @@ my_read(void) break; case SHPT_POINT: - wpt = waypt_new(); + wpt = new waypoint; wpt->latitude = shp->dfYMin; wpt->longitude = shp->dfXMin; wpt->shortname = name; diff --git a/gpsbabel/skyforce.cc b/gpsbabel/skyforce.cc index 1ac4a039a..2485dbc61 100644 --- a/gpsbabel/skyforce.cc +++ b/gpsbabel/skyforce.cc @@ -50,7 +50,7 @@ skyforce_parse_coords(const char* str) fatal(MYNAME ": Incomplete line!\n"); } - wpt = waypt_new(); + wpt = new waypoint; wpt->latitude = atof(str + 21); if (str[20] == 'S') { diff --git a/gpsbabel/skytraq.cc b/gpsbabel/skytraq.cc index 4aff7291b..dfdc6bff0 100644 --- a/gpsbabel/skytraq.cc +++ b/gpsbabel/skytraq.cc @@ -661,7 +661,7 @@ state_init(struct read_state* pst) static waypoint* make_trackpoint(struct read_state* st, double lat, double lon, double alt) { - waypoint* wpt = waypt_new(); + waypoint* wpt = new waypoint; xasprintf(&wpt->shortname, "TP%04d", ++st->tpn); @@ -858,7 +858,7 @@ process_data_item(struct read_state* pst, const item_frame* pitem, int len) WAYPT_SET(tpt, speed, KPH_TO_MPS(ITEM_SPEED(pitem))); /* convert speed to m/s */ if (poi) { - waypt_add(waypt_dupe(tpt)); + waypt_add(new waypoint(*tpt)); } if (0 == pst->route_head_) { @@ -1527,7 +1527,7 @@ static void miniHomer_get_poi() } else { ECEF_to_LLA(ecef_x, ecef_y, ecef_z, &lat, &lng, &alt); - wpt = waypt_new(); + wpt = new waypoint; xasprintf(&wpt->shortname, "POI_%s", poinames[poi]); xasprintf(&wpt->description, "miniHomer points to this coordinates if the %s symbol is on", poinames[poi]); wpt->latitude = lat; diff --git a/gpsbabel/smplrout.cc b/gpsbabel/smplrout.cc index 4ade18264..520059fd6 100644 --- a/gpsbabel/smplrout.cc +++ b/gpsbabel/smplrout.cc @@ -337,7 +337,7 @@ routesimple_tail(const route_head* rte) } (*waypt_del_fnp)((route_head*)(void*)rte, (waypoint*)(void*)(xte_recs[i].intermed->wpt)); - waypt_free((waypoint*)(void*)(xte_recs[i].intermed->wpt)); + delete (waypoint*)(void*)(xte_recs[i].intermed->wpt); if (xte_recs[i].intermed->prev) { xte_recs[i].intermed->prev->next = xte_recs[i].intermed->next; diff --git a/gpsbabel/stackfilter.cc b/gpsbabel/stackfilter.cc index 11a66e9ee..4e2c61fae 100644 --- a/gpsbabel/stackfilter.cc +++ b/gpsbabel/stackfilter.cc @@ -109,7 +109,7 @@ stackfilt_process(void) stack = tmp_elt; if (opt_copy) { QUEUE_FOR_EACH(&(stack->waypts), elem, tmp) { - waypt_add(waypt_dupe((waypoint*)elem)); + waypt_add(new waypoint(*(waypoint*)elem)); } } diff --git a/gpsbabel/stmsdf.cc b/gpsbabel/stmsdf.cc index b4a577fdb..cc88b77c5 100644 --- a/gpsbabel/stmsdf.cc +++ b/gpsbabel/stmsdf.cc @@ -264,7 +264,7 @@ parse_point(char* line) warning(MYNAME ": Unknown point type %s at line %d!\n", str, lineno); return; } - wpt = waypt_new(); + wpt = new waypoint; break; case 1: diff --git a/gpsbabel/stmwpp.cc b/gpsbabel/stmwpp.cc index 96ebe2782..4b0fce940 100644 --- a/gpsbabel/stmwpp.cc +++ b/gpsbabel/stmwpp.cc @@ -125,7 +125,7 @@ stmwpp_data_read(void) } what = new_what; - wpt = waypt_new(); + wpt = new waypoint; break; case 1: @@ -175,7 +175,7 @@ stmwpp_data_read(void) route = route_head_alloc(); route_add_head(route); } - route_add_wpt(route, waypt_dupe(wpt)); + route_add_wpt(route, new waypoint(*wpt)); } break; diff --git a/gpsbabel/tef_xml.cc b/gpsbabel/tef_xml.cc index 520307309..bd8df7933 100644 --- a/gpsbabel/tef_xml.cc +++ b/gpsbabel/tef_xml.cc @@ -211,13 +211,13 @@ waypoint_final() if (route != NULL) { if ((via != 0) || (routevia == NULL)) { - waypoint* wpt = waypt_dupe(wpt_tmp); + waypoint* wpt = new waypoint(*wpt_tmp); route_add_wpt(route, wpt); } } if (via == 0) { - waypt_free(wpt_tmp); + delete wpt_tmp; } wpt_tmp = NULL; @@ -243,7 +243,7 @@ tef_item_start(xg_string args, const QXmlStreamAttributes* attrv) { waypoints++; - wpt_tmp = waypt_new(); + wpt_tmp = new waypoint; if ((waypoints == 1) || (waypoints == item_count)) { wpt_tmp->wpt_flags.fmt_use ++; } diff --git a/gpsbabel/teletype.cc b/gpsbabel/teletype.cc index 3ff3133b0..a2eb412c5 100644 --- a/gpsbabel/teletype.cc +++ b/gpsbabel/teletype.cc @@ -59,7 +59,7 @@ teletype_read(void) { uint32_t i; for (i = 0; i < tty_wpt_count; i++) { - waypoint* wpt = waypt_new(); + waypoint* wpt = new waypoint; wpt->shortname = (gbfgetcstr(fin)); wpt->description = (gbfgetcstr(fin)); diff --git a/gpsbabel/tiger.cc b/gpsbabel/tiger.cc index 7475ab353..77a0e067a 100644 --- a/gpsbabel/tiger.cc +++ b/gpsbabel/tiger.cc @@ -166,7 +166,7 @@ data_read(void) } if (sscanf(ibuf, "%lf,%lf:%100[^:]:%100[^\n]", &lon, &lat, icon, desc)) { - wpt_tmp = waypt_new(); + wpt_tmp = new waypoint; wpt_tmp->longitude = lon; wpt_tmp->latitude = lat; diff --git a/gpsbabel/tmpro.cc b/gpsbabel/tmpro.cc index 5684e8fc9..a09a36d46 100644 --- a/gpsbabel/tmpro.cc +++ b/gpsbabel/tmpro.cc @@ -82,7 +82,7 @@ data_read(void) /* skip the line if it contains "sHyperLink" as it is a header (I hope :) */ if ((strlen(buff)) && (strstr(buff, "sHyperLink") == NULL)) { - wpt_tmp = waypt_new(); + wpt_tmp = new waypoint; /* data delimited by tabs, not enclosed in quotes. */ s = buff; @@ -154,7 +154,7 @@ data_read(void) } if (i != 11) { - waypt_free(wpt_tmp); + delete wpt_tmp; warning(MYNAME ": WARNING - extracted %d fields from line %d. \nData on line ignored.\n", i, linecount); } else { diff --git a/gpsbabel/tomtom.cc b/gpsbabel/tomtom.cc index 36e5a5fd3..9eb72146b 100644 --- a/gpsbabel/tomtom.cc +++ b/gpsbabel/tomtom.cc @@ -191,7 +191,7 @@ data_read(void) desc = (char*)xmalloc(recsize - 13); gbfread(desc, recsize-13, 1, file_in); - wpt_tmp = waypt_new(); + wpt_tmp = new waypoint; wpt_tmp->longitude = x/100000.0; wpt_tmp->latitude = y/100000.0; @@ -212,7 +212,7 @@ data_read(void) #if 0 // Fallthrough for now to silently ignore these until this is done. recsize = read_char(file_in) ; check_recsize(recsize); - wpt_tmp = waypt_new(); + wpt_tmp = new waypoint; decode_latlon(&wpt_tmp->latitude, &wpt_tmp->longitude); gbfread(tbuf, 3, 1, file_in); gbfread(tbuf, 3, 1, file_in); diff --git a/gpsbabel/tpg.cc b/gpsbabel/tpg.cc index 8d8c4d0ff..e56bc40a1 100644 --- a/gpsbabel/tpg.cc +++ b/gpsbabel/tpg.cc @@ -119,7 +119,7 @@ tpg_read(void) while (pointcount--) { - wpt_tmp = waypt_new(); + wpt_tmp = new waypoint; /* pascal-like shortname */ wpt_tmp->shortname = gbfgetpstr(tpg_file_in); diff --git a/gpsbabel/tpo.cc b/gpsbabel/tpo.cc index 2b3828001..0d4fef280 100644 --- a/gpsbabel/tpo.cc +++ b/gpsbabel/tpo.cc @@ -342,7 +342,7 @@ void tpo_read_2_x(void) /* multiply all the deltas by the scaling factors to determine the waypoint positions */ for (j=0; jwaypoint_list, elem, tmp) { waypoint* wpt = (waypoint*)elem; track_del_wpt((route_head*)track, wpt); - waypt_free(wpt); + delete wpt; } track_del_head((route_head*)track); return; @@ -520,10 +520,10 @@ trackfilter_merge(void) QUEUE_FOR_EACH((queue*)&track->waypoint_list, elem, tmp) { wpt = (waypoint*)elem; if (wpt->creation_time.isValid()) { - buff[j++] = waypt_dupe(wpt); + buff[j++] = new waypoint(*wpt); } track_del_wpt(track, wpt); - waypt_free(wpt); + delete wpt; } if (track != master) { /* i > 0 */ track_del_head(track); @@ -542,7 +542,7 @@ trackfilter_merge(void) route_add_wpt(master, wpt); prev = wpt; } else { - waypt_free(wpt); + delete wpt; dropped++; } } @@ -920,7 +920,7 @@ trackfilter_range(void) /* returns number of track points left after filtering if (! inside) { track_del_wpt(track, wpt); - waypt_free(wpt); + delete wpt; dropped++; } } diff --git a/gpsbabel/transform.cc b/gpsbabel/transform.cc index e8338141b..af5b79e83 100644 --- a/gpsbabel/transform.cc +++ b/gpsbabel/transform.cc @@ -95,7 +95,7 @@ transform_waypoints(void) waypoint* wpt = (waypoint*) elem; #endif - wpt = waypt_dupe(wpt); + wpt = new waypoint(*wpt); switch (current_target) { case 'R': route_add_wpt_named(rte, wpt, RPT, name_digits); @@ -153,7 +153,7 @@ transform_trk_disp_hdr_cb(const route_head* trk) static void transform_any_disp_wpt_cb(const waypoint* wpt) { - waypoint* temp = waypt_dupe(wpt); + waypoint* temp = new waypoint(*wpt); if (current_target == 'R') { route_add_wpt_named(current_rte, temp, current_namepart, name_digits); } else if (current_target == 'T') { diff --git a/gpsbabel/unicsv.cc b/gpsbabel/unicsv.cc index 210bc2e49..bb23dbb41 100644 --- a/gpsbabel/unicsv.cc +++ b/gpsbabel/unicsv.cc @@ -655,7 +655,7 @@ unicsv_parse_one_line(char* ibuf) int ns = 1; int ew = 1; geocache_data* gc_data = NULL; - wpt = waypt_new(); + wpt = new waypoint; wpt->latitude = unicsv_unknown; wpt->longitude = unicsv_unknown; memset(&ymd, 0, sizeof(ymd)); @@ -1040,7 +1040,7 @@ unicsv_parse_one_line(char* ibuf) case fld_gc_placer_id: case fld_gc_hint: - gc_data = waypt_alloc_gc_data(wpt); + gc_data = wpt->AllocGCData(); switch (unicsv_fields_tab[column]) { @@ -1107,7 +1107,7 @@ unicsv_parse_one_line(char* ibuf) } if (checked == 0) { - waypt_free(wpt); + delete wpt; return; } @@ -1405,7 +1405,7 @@ unicsv_waypt_enum_cb(const waypoint* wpt) } } - if (! waypt_empty_gc_data(wpt)) { + if (! wpt->EmptyGCData()) { const geocache_data* gc_data = wpt->gc_data; if (gc_data->id) { @@ -1766,7 +1766,7 @@ unicsv_waypt_disp_cb(const waypoint* wpt) unicsv_print_str(GMSD_GET(email, NULL)); } - if (waypt_empty_gc_data(wpt)) { + if (wpt->EmptyGCData()) { gc_data = NULL; } else { gc_data = wpt->gc_data; diff --git a/gpsbabel/v900.cc b/gpsbabel/v900.cc index 7a9cba311..3c17b6676 100644 --- a/gpsbabel/v900.cc +++ b/gpsbabel/v900.cc @@ -300,7 +300,7 @@ v900_read(void) line.bas.cr = 0; /* null terminate vox field */ } - wpt = waypt_new(); + wpt = new waypoint; /* lat is a string in the form: 31.768380N */ c = line.bas.common.latitude_NS; /* N/S */ @@ -362,7 +362,7 @@ v900_read(void) // thread on gpsbabel-misc with Jamie Robertson. assert(line.bas.common.tag == 'C' || line.bas.common.tag == 'G' || line.bas.common.tag == 'V'); - wpt2 = waypt_dupe(wpt); + wpt2 = new waypoint(*wpt); if (line.bas.common.tag == 'V') { // waypoint with voice recording? char vox_file_name[sizeof(line.adv.vox)+5]; const char* vox = is_advanced_mode ? line.adv.vox : line.bas.vox; diff --git a/gpsbabel/vidaone.cc b/gpsbabel/vidaone.cc index 08e63249d..335ec6ad1 100644 --- a/gpsbabel/vidaone.cc +++ b/gpsbabel/vidaone.cc @@ -77,7 +77,7 @@ vidaone_read(void) route_head* trk = NULL; while (! gbfeof(fin)) { - waypoint* wpt = waypt_new(); + waypoint* wpt = new waypoint; wpt->latitude = gbfgetdbl(fin); wpt->longitude = gbfgetdbl(fin); diff --git a/gpsbabel/vitosmt.cc b/gpsbabel/vitosmt.cc index 57e7da361..131e48304 100644 --- a/gpsbabel/vitosmt.cc +++ b/gpsbabel/vitosmt.cc @@ -154,7 +154,7 @@ vitosmt_read(void) gpsvalid =gbfgetc(infile); /* fix is valid */ gpssats =gbfgetc(infile); /* number of sats */ - wpt_tmp = waypt_new(); + wpt_tmp = new waypoint; wpt_tmp->latitude =DEG(latrad); wpt_tmp->longitude =DEG(lonrad); diff --git a/gpsbabel/vitovtt.cc b/gpsbabel/vitovtt.cc index b87a358be..f672b9a8f 100644 --- a/gpsbabel/vitovtt.cc +++ b/gpsbabel/vitovtt.cc @@ -103,7 +103,7 @@ vitovtt_read(void) course = gbfgetint16(infile); status = gbfgetint32(infile); - wpt_tmp = waypt_new(); + wpt_tmp = new waypoint; wpt_tmp->latitude = scaled_lat / vitovtt_latitudescale; wpt_tmp->longitude = scaled_lon / vitovtt_longitudescale; diff --git a/gpsbabel/vpl.cc b/gpsbabel/vpl.cc index 6af30185f..97abf82ee 100644 --- a/gpsbabel/vpl.cc +++ b/gpsbabel/vpl.cc @@ -195,7 +195,7 @@ vpl_parse_75_sentence(const char* ibuf) ymd /= 100; tm.tm_year = ymd % 100 + 100; - waypt = waypt_new(); + waypt = new waypoint; // Lat/Lon are both stored *0xE1000 which we have to divide out // for decimal degrees diff --git a/gpsbabel/waypt.cc b/gpsbabel/waypt.cc index 3f2f964b3..3f0071b95 100644 --- a/gpsbabel/waypt.cc +++ b/gpsbabel/waypt.cc @@ -59,14 +59,6 @@ waypt_init(void) #endif } -// This whole thing is a poor-man's copy constructor. It exists mostly -// as a bridge from our non-reference counted C types to classes now. -waypoint* -waypt_dupe(const waypoint* wpt) -{ - return new waypoint(*wpt); -} - void update_common_traits(const waypoint* wpt) { /* This is a bit tacky, but it allows a hint whether we've seen @@ -159,16 +151,6 @@ waypt_del(waypoint* wpt) #endif } -/* - * A constructor for a single waypoint. - */ -waypoint* -waypt_new(void) -{ - waypoint* wpt = new waypoint; - return wpt; -} - unsigned int waypt_count(void) { @@ -342,18 +324,12 @@ find_waypt_by_name(const QString& name) return NULL; } -void -waypt_free(waypoint* wpt) -{ - delete wpt; -} - #if NEWQ void waypt_flush(queue* head) { while (!waypt_list.isEmpty()) { - waypt_free(waypt_list.takeFirst()); + delete waypt_list.takeFirst(); } } #else @@ -364,7 +340,7 @@ waypt_flush(queue* head) QUEUE_FOR_EACH(head, elem, tmp) { waypoint* q = (waypoint*) dequeue(elem); - waypt_free(q); + delete q; if (head == &waypt_head) { waypt_ct--; } @@ -405,7 +381,7 @@ waypt_backup(signed int* count, queue** head_bak) QUEUE_FOR_EACH(qbackup, elem, tmp) { wpt = (waypoint*)elem; - waypt_add(waypt_dupe(wpt)); + waypt_add(new waypoint(*wpt)); no++; } @@ -568,19 +544,6 @@ waypt_course(const waypoint* A, const waypoint* B) } } -geocache_data* -waypt_alloc_gc_data(waypoint* wpt) -{ - return wpt->AllocGCData(); -} - -int -waypt_empty_gc_data(const waypoint* wpt) -{ - return wpt->EmptyGCData(); -} - - waypoint::waypoint() : // Q(), latitude(0), // These should probably use some invalid data, but diff --git a/gpsbabel/wbt-200.cc b/gpsbabel/wbt-200.cc index 1223f94b7..8c02e8437 100644 --- a/gpsbabel/wbt-200.cc +++ b/gpsbabel/wbt-200.cc @@ -543,7 +543,7 @@ static int check_date(uint32_t tim) static waypoint* make_point(double lat, double lon, double alt, time_t tim, const char* fmt, int index) { char wp_name[20]; - waypoint* wpt = waypt_new(); + waypoint* wpt = new waypoint; sprintf(wp_name, fmt, index); diff --git a/gpsbabel/wfff_xml.cc b/gpsbabel/wfff_xml.cc index c58b67a22..48721d341 100644 --- a/gpsbabel/wfff_xml.cc +++ b/gpsbabel/wfff_xml.cc @@ -223,7 +223,7 @@ void wfff_e(xg_string args, const QXmlStreamAttributes* unused) char desc[255] ="\0"; if ((ap_hdop>=1)&&(ap_hdop<50)) { // Discard invalid GPS fix - wpt_tmp = waypt_new(); + wpt_tmp = new waypoint; if (snmac) { wpt_tmp->shortname = ap_mac; diff --git a/gpsbabel/wintec_tes.cc b/gpsbabel/wintec_tes.cc index 71cb009cb..1348e464f 100644 --- a/gpsbabel/wintec_tes.cc +++ b/gpsbabel/wintec_tes.cc @@ -68,7 +68,7 @@ wintec_tes_read(void) int16_t alt = gbfgetint16(fin); // Signed. Meters. (void) flags; // Silence 'unused' warning until we use flags. - wpt = waypt_new(); + wpt = new waypoint; wpt->latitude = latitude / 1.0e7; wpt->longitude = longitude / 1.0e7; wpt->SetCreationTime(wintec_date_to_time(date)); @@ -85,7 +85,7 @@ wintec_tes_read(void) // Wintec's software puts a waypoint in the track, so we // mock that. if (flags & 0x02) { - waypoint* temp = waypt_dupe(wpt); + waypoint* temp = new waypoint(*wpt); waypt_add(temp); } diff --git a/gpsbabel/xol.cc b/gpsbabel/xol.cc index fa7ba5dc0..352957db9 100644 --- a/gpsbabel/xol.cc +++ b/gpsbabel/xol.cc @@ -70,7 +70,7 @@ xol_shape(xg_string args, const QXmlStreamAttributes* attrv) { if (attrv->hasAttribute("type")) { if (attrv->value("type") == "waypoint") { - wpt = waypt_new(); + wpt = new waypoint; } else if (attrv->value("type") == "polyline") { trk = route_head_alloc(); track_add_head(trk); diff --git a/gpsbabel/yahoo.cc b/gpsbabel/yahoo.cc index dfd2e8ee1..ce153cc3b 100644 --- a/gpsbabel/yahoo.cc +++ b/gpsbabel/yahoo.cc @@ -81,7 +81,7 @@ yahoo_wr_init(const char* fname) void wpt_s(xg_string args, const QXmlStreamAttributes* unused) { - wpt_tmp = waypt_new(); + wpt_tmp = new waypoint; } void wpt_e(xg_string args, const QXmlStreamAttributes* unused) -- 2.30.2